Skip to content

Commit d5d1135

Browse files
committed
model: fix resolving classname within child classes
1 parent aed7065 commit d5d1135

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Skeleton/Object/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ trait Model {
7070
public function __construct($id = null) {
7171
if (property_exists(__CLASS__, 'class_configuration') && isset(self::$class_configuration['child_classname_field'])) {
7272
$classname_field = self::$class_configuration['child_classname_field'];
73-
$this->details[$classname_field] = __CLASS__;
73+
$this->details[$classname_field] = get_class($this);
7474
}
7575

7676
if ($id !== null) {
@@ -94,7 +94,7 @@ public function cast($classname) {
9494
throw new \Exception('Classname "' . $classname . '" doesn\'t exist');
9595
}
9696

97-
if (__CLASS__ == $classname) {
97+
if (get_class($this) == $classname) {
9898
return $this;
9999
}
100100

0 commit comments

Comments
 (0)