File tree Expand file tree Collapse file tree 5 files changed +12
-8
lines changed
Expand file tree Collapse file tree 5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -221,11 +221,15 @@ public function getEntity(array $fieldValues = []): object
221221 $ instance = new $ class ();
222222
223223 // The command below is to get all properties of the class.
224- // This will allow to process all properties, even if they are not in the $fieldValues array.
224+ // This will allow processing all properties, even if they are not in the $fieldValues array.
225225 // Particularly useful for processing the selectFunction.
226226 $ fieldValues = array_merge (Serialize::from ($ instance )->withStopAtFirstLevel ()->toArray (), $ fieldValues );
227227 ObjectCopy::copy ($ fieldValues , $ instance , new MapFromDbToInstanceHandler ($ this ));
228228
229+ if (is_array ($ instance )) {
230+ $ instance = (object )$ instance ;
231+ }
232+
229233 return $ instance ;
230234 }
231235
Original file line number Diff line number Diff line change 44
55class Class1
66{
7- public ?int $ id ;
7+ public ?int $ id = null ;
88}
Original file line number Diff line number Diff line change 44
55class Class2
66{
7- public ?int $ id ;
7+ public ?int $ id = null ;
88
9- public ?int $ idTable1 ;
9+ public ?int $ idTable1 = null ;
1010}
Original file line number Diff line number Diff line change 99class Class3
1010{
1111 #[FieldAttribute(primaryKey: true )]
12- public ?int $ id ;
12+ public ?int $ id = null ;
1313
1414 #[FieldAttribute(fieldName: "id_table1 " , parentTable: "table1 " )]
15- public ?int $ idTable1 ;
15+ public ?int $ idTable1 = null ;
1616}
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ class Class4
1212 use DeletedAt;
1313
1414 #[FieldAttribute(primaryKey: true )]
15- public ?int $ id ;
15+ public ?int $ id = null ;
1616
1717 #[FieldAttribute(fieldName: "id_table2 " , parentTable: "table2 " )]
18- public ?int $ idTable2 ;
18+ public ?int $ idTable2 = null ;
1919}
You can’t perform that action at this time.
0 commit comments