File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ public function __construct(
161161 public function hydrate (
162162 JsonAPIDocument \IDocument $ document ,
163163 object |null $ entity = null ,
164+ bool $ includeRelationShips = true ,
164165 ): Utils \ArrayHash
165166 {
166167 $ entityMapping = $ this ->mapEntity ($ this ->getEntityName ());
@@ -186,12 +187,16 @@ public function hydrate(
186187 null ,
187188 );
188189
189- $ relationships = $ this ->hydrateRelationships (
190- $ resource ->getRelationships (),
191- $ entityMapping ,
192- $ document ->hasIncluded () ? $ document ->getIncluded () : null ,
193- $ entity ,
194- );
190+ $ relationships = [];
191+
192+ if ($ includeRelationShips ) {
193+ $ relationships = $ this ->hydrateRelationships (
194+ $ resource ->getRelationships (),
195+ $ entityMapping ,
196+ $ document ->hasIncluded () ? $ document ->getIncluded () : null ,
197+ $ entity ,
198+ );
199+ }
195200
196201 if ($ this ->errors ->hasErrors ()) {
197202 throw $ this ->errors ;
You can’t perform that action at this time.
0 commit comments