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() {
86
86
throw new BaseException ('Classes that use the \jlorente\db\ActiveRecordInheritanceTrait must implement \jlorente\db\ActiveRecordInheritanceInterface ' );
87
87
}
88
88
$ 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 ;
91
91
} else {
92
92
$ this ->_parent = new $ pClass ();
93
93
}
94
94
}
95
95
return $ this ->_parent ;
96
96
}
97
97
98
+ /**
99
+ * @inheritdoc
100
+ */
101
+ public static function populateRecord ($ record , $ row ) {
102
+ parent ::populateRecord ($ record , $ row );
103
+
104
+ $ record ->_parent = $ record ->parent ;
105
+ }
106
+
98
107
/**
99
108
* @inheritdoc
100
109
*/
You can’t perform that action at this time.
0 commit comments