From fd6e44d5117255d0406e0b96d43c165d77785f87 Mon Sep 17 00:00:00 2001 From: Colin Tucker Date: Wed, 24 May 2017 14:19:21 +1000 Subject: [PATCH] Removed references to $object->class --- src/Admin/PageIconFix.php | 2 +- src/Dev/FixtureBlueprint.php | 6 +++--- src/Dev/FixtureFactory.php | 6 +++--- src/Extensions/Config/PageTypeConfig.php | 4 ++-- src/Extensions/Model/URLSegmentExtension.php | 6 +++--- src/Lists/ListItem.php | 2 +- src/Model/Component.php | 8 ++++---- src/View/Renderable.php | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Admin/PageIconFix.php b/src/Admin/PageIconFix.php index ffefb32..964bfe8 100644 --- a/src/Admin/PageIconFix.php +++ b/src/Admin/PageIconFix.php @@ -39,6 +39,6 @@ public function CMSTreeClasses() { $classes = parent::CMSTreeClasses(); - return ClassTools::singleton()->getStyleClasses($classes, $this->class); + return ClassTools::singleton()->getStyleClasses($classes, static::class); } } diff --git a/src/Dev/FixtureBlueprint.php b/src/Dev/FixtureBlueprint.php index e22cb26..5ae57f1 100644 --- a/src/Dev/FixtureBlueprint.php +++ b/src/Dev/FixtureBlueprint.php @@ -318,7 +318,7 @@ public function mutateClass(DataObject $object, $identifier, $data) sprintf( 'Mutating %s (%s to %s)', $identifier, - $object->class, + get_class($object), $class ) ); @@ -1060,7 +1060,7 @@ public function getRelationList(DataObject $object, $field) */ public function createMessage(DataObject $object, $identifier) { - $this->changeMessage(sprintf('Creating %s.%s', $object->class, $identifier), 'created'); + $this->changeMessage(sprintf('Creating %s.%s', get_class($object), $identifier), 'created'); } /** @@ -1073,7 +1073,7 @@ public function createMessage(DataObject $object, $identifier) */ public function updateMessage(DataObject $object, $identifier) { - $this->changeMessage(sprintf('Updating %s.%s', $object->class, $identifier), 'changed'); + $this->changeMessage(sprintf('Updating %s.%s', get_class($object), $identifier), 'changed'); } /** diff --git a/src/Dev/FixtureFactory.php b/src/Dev/FixtureFactory.php index 7b339c0..a287325 100644 --- a/src/Dev/FixtureFactory.php +++ b/src/Dev/FixtureFactory.php @@ -101,11 +101,11 @@ public function getDefaultBlueprint($name) */ public function addFixture($object, $identifier) { - if (!isset($this->fixtures[$object->class])) { - $this->fixtures[$object->class] = []; + if (!isset($this->fixtures[get_class($object)])) { + $this->fixtures[get_class($object)] = []; } - $this->fixtures[$object->class][$identifier] = $object->ID; + $this->fixtures[get_class($object)][$identifier] = $object->ID; } /** diff --git a/src/Extensions/Config/PageTypeConfig.php b/src/Extensions/Config/PageTypeConfig.php index a1583d0..7cff58e 100644 --- a/src/Extensions/Config/PageTypeConfig.php +++ b/src/Extensions/Config/PageTypeConfig.php @@ -106,7 +106,7 @@ public function updateFieldLabels(&$labels) */ public function getTemplateForPage(SiteTree $page) { - return $this->getTemplateForClass($page->class); + return $this->getTemplateForClass(get_class($page)); } /** @@ -118,7 +118,7 @@ public function getTemplateForPage(SiteTree $page) */ public function getLayoutForPage(SiteTree $page) { - return $this->getLayoutForClass($page->class); + return $this->getLayoutForClass(get_class($page)); } /** diff --git a/src/Extensions/Model/URLSegmentExtension.php b/src/Extensions/Model/URLSegmentExtension.php index daf036b..8d5c141 100644 --- a/src/Extensions/Model/URLSegmentExtension.php +++ b/src/Extensions/Model/URLSegmentExtension.php @@ -71,7 +71,7 @@ public function onBeforeWrite() */ public function requireDefaultRecords() { - $class = $this->owner->class; + $class = get_class($this->owner); $records = DataList::create($class)->where('URLSegment IS NULL'); @@ -92,7 +92,7 @@ public function requireDefaultRecords() */ public function validURLSegment() { - $list = DataList::create($this->owner->class)->filter(['URLSegment' => $this->owner->URLSegment]); + $list = DataList::create(get_class($this->owner))->filter(['URLSegment' => $this->owner->URLSegment]); if ($id = $this->owner->ID) { $list = $list->exclude(['ID' => $id]); @@ -111,7 +111,7 @@ public function validURLSegment() public function generateURLSegment($string) { if (!$string) { - $class = ClassTools::singleton()->getClassWithoutNamespace($this->owner->class); + $class = ClassTools::singleton()->getClassWithoutNamespace(get_class($this->owner)); $string = sprintf('%s-%s', $class, $this->owner->ID); } diff --git a/src/Lists/ListItem.php b/src/Lists/ListItem.php index 5e71529..8e7448f 100644 --- a/src/Lists/ListItem.php +++ b/src/Lists/ListItem.php @@ -93,7 +93,7 @@ public function getListItemClassNames() */ public function getListItemTemplate() { - $template = sprintf('%s\ListItem', $this->class); + $template = sprintf('%s\ListItem', static::class); if (SSViewer::hasTemplate($template)) { return $template; diff --git a/src/Model/Component.php b/src/Model/Component.php index db9e253..1487b1f 100644 --- a/src/Model/Component.php +++ b/src/Model/Component.php @@ -243,7 +243,7 @@ public function CMSTreeClasses() { $classes = parent::CMSTreeClasses(); - $classes = ClassTools::singleton()->getStyleClasses($classes, $this->class); + $classes = ClassTools::singleton()->getStyleClasses($classes, static::class); if (!$this->canEdit()) { $classes .= ' hidden'; @@ -270,7 +270,7 @@ public function canCreate($member = null, $context = []) // Obtain Parent Class: - $class = $context['Parent']->class; + $class = get_class($context['Parent']); // Obtain Allowed Parents: @@ -639,7 +639,7 @@ public function getCurrentPage($class = null) public function getCurrentPageClass() { if ($page = $this->getCurrentPage()) { - return $page->class; + return get_class($page); } } @@ -764,7 +764,7 @@ public function getCustomCSS() */ public function getCustomCSSTemplate() { - return sprintf('%s\CustomCSS', $this->class); + return sprintf('%s\CustomCSS', static::class); } /** diff --git a/src/View/Renderable.php b/src/View/Renderable.php index d260668..d9497ff 100644 --- a/src/View/Renderable.php +++ b/src/View/Renderable.php @@ -322,8 +322,8 @@ public function setStyleIDFrom(DataObject $object) { $this->StyleID = sprintf( '%s_%s', - ClassTools::singleton()->getClassWithoutNamespace($object->class), - ClassTools::singleton()->getClassWithoutNamespace($this->class) + ClassTools::singleton()->getClassWithoutNamespace(get_class($object)), + ClassTools::singleton()->getClassWithoutNamespace(get_class($this)) ); return $this; @@ -338,7 +338,7 @@ public function setStyleIDFrom(DataObject $object) */ public function getClassNameWithID($includeNamespace = false) { - $className = $this->class; + $className = static::class; if (!$includeNamespace) { $className = ClassTools::singleton()->getClassWithoutNamespace($className);