File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
src/Picqer/Financials/Moneybird Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -260,15 +260,19 @@ public function selfFromResponse($response)
260260
261261 foreach ($ this ->getSingleNestedEntities () as $ key => $ value )
262262 {
263- $ entityName = 'Picqer\Financials\Moneybird\Entities \\' . $ value ;
264- $ this ->$ key = new $ entityName ($ this ->connection , $ response [$ key ]);
263+ if (isset ($ response [$ key ])) {
264+ $ entityName = 'Picqer\Financials\Moneybird\Entities \\' . $ value ;
265+ $ this ->$ key = new $ entityName ($ this ->connection , $ response [$ key ]);
266+ }
265267 }
266268
267269 foreach ($ this ->getMultipleNestedEntities () as $ key => $ value )
268270 {
269- $ entityName = 'Picqer\Financials\Moneybird\Entities \\' . $ value ['entity ' ];
270- $ instaniatedEntity = new $ entityName ($ this ->connection );
271- $ this ->$ key = $ instaniatedEntity ->collectionFromResult ($ response [$ key ]);
271+ if (isset ($ response [$ key ])) {
272+ $ entityName = 'Picqer\Financials\Moneybird\Entities \\' . $ value ['entity ' ];
273+ $ instaniatedEntity = new $ entityName ($ this ->connection );
274+ $ this ->$ key = $ instaniatedEntity ->collectionFromResult ($ response [$ key ]);
275+ }
272276 }
273277
274278 return $ this ;
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ public function testContactEntity()
1919 $ this ->performEntityTest ('\Picqer\Financials\Moneybird\Entities\Contact ' );
2020 }
2121
22+ public function testContactCustomFieldEntity ()
23+ {
24+ $ this ->performEntityTest ('\Picqer\Financials\Moneybird\Entities\ContactCustomField ' );
25+ }
26+
2227 public function testCustomFieldEntity ()
2328 {
2429 $ this ->performEntityTest ('\Picqer\Financials\Moneybird\Entities\CustomField ' );
You can’t perform that action at this time.
0 commit comments