File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function getParent($recalculate = false)
92
92
throw new BaseException ('Classes that use the \jlorente\db\ActiveRecordInheritanceTrait must implement \jlorente\db\ActiveRecordInheritanceInterface ' );
93
93
}
94
94
$ pClass = static ::extendsFrom ();
95
- if ($ this ->getParentAttributeValue () && $ this -> getIsNewRecord () === false && ($ parent = $ this ->_parent ()->one ())) {
95
+ if ($ this ->getParentAttributeValue () && ($ parent = $ this ->_parent ()->one ())) {
96
96
$ this ->_parent = $ parent ;
97
97
} else {
98
98
$ this ->_parent = new $ pClass ();
@@ -470,8 +470,6 @@ public function loadDefaultValues($skipIfSet = true)
470
470
*/
471
471
public function getParentAttributeValue ()
472
472
{
473
- $ ownAttributes = $ this ->attributes ();
474
- $ parentAttribute = $ this ->parentAttribute ();
475
- return isset ($ ownAttributes [$ parentAttribute ]) ? $ ownAttributes [$ parentAttribute ] : null ;
473
+ return $ this ->{$ this ->parentAttribute ()};
476
474
}
477
475
}
You can’t perform that action at this time.
0 commit comments