File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -86,15 +86,24 @@ private function _parent() {
8686 throw new BaseException ('Classes that use the \jlorente\db\ActiveRecordInheritanceTrait must implement \jlorente\db\ActiveRecordInheritanceInterface ' );
8787 }
8888 $ pClass = static ::extendsFrom ();
89- if ($ this ->id !== null ) {
90- $ this ->_parent = $ pClass :: findOne ( $ this ->{ $ this -> parentAttribute ()}) ;
89+ if ($ this ->getIsNewRecord () === false ) {
90+ $ this ->_parent = $ this ->parent ;
9191 } else {
9292 $ this ->_parent = new $ pClass ();
9393 }
9494 }
9595 return $ this ->_parent ;
9696 }
9797
98+ /**
99+ * @inheritdoc
100+ */
101+ public static function populateRecord ($ record , $ row ) {
102+ parent ::populateRecord ($ record , $ row );
103+
104+ $ record ->_parent = $ record ->parent ;
105+ }
106+
98107 /**
99108 * @inheritdoc
100109 */
You can’t perform that action at this time.
0 commit comments