@@ 113-127 (lines=15) @@ | ||
110 | $row = $result[0]; |
|
111 | ||
112 | $relatedEntityIds = []; |
|
113 | foreach ($this->with as $relatedEntityName => $cascadeWith) { |
|
114 | $relatedField = $this->getRelatedField($relatedEntityName); |
|
115 | ||
116 | if (!isset($row[$relatedField])) { |
|
117 | throw new \RuntimeException(get_class($this) . ": relation field $relatedEntityName not fetched"); |
|
118 | } |
|
119 | ||
120 | if (!isset($relatedEntityIds[$relatedEntityName])) { |
|
121 | $relatedEntityIds[$relatedEntityName] = new ArrayObject(); |
|
122 | } |
|
123 | ||
124 | if (!in_array($row[$relatedField], (array)$relatedEntityIds[$relatedEntityName])) { |
|
125 | $relatedEntityIds[$relatedEntityName]->append($row[$relatedField]); |
|
126 | } |
|
127 | } |
|
128 | ||
129 | $relatedEntities = []; |
|
130 | foreach ($this->with as $relatedEntityName => $cascadeWith) { |
|
@@ 184-200 (lines=17) @@ | ||
181 | } |
|
182 | ||
183 | $relatedEntityIds = []; |
|
184 | foreach ($rows as $row) { |
|
185 | foreach ($this->with as $relatedEntityName => $cascadeWith) { |
|
186 | $relatedField = $this->getRelatedField($relatedEntityName); |
|
187 | ||
188 | if (!isset($row[$relatedField])) { |
|
189 | throw new \RuntimeException(get_class($this) . ": relation field $relatedEntityName not fetched"); |
|
190 | } |
|
191 | ||
192 | if (!isset($relatedEntityIds[$relatedEntityName])) { |
|
193 | $relatedEntityIds[$relatedEntityName] = new ArrayObject(); |
|
194 | } |
|
195 | ||
196 | if (!in_array($row[$relatedField], (array)$relatedEntityIds[$relatedEntityName])) { |
|
197 | $relatedEntityIds[$relatedEntityName]->append($row[$relatedField]); |
|
198 | } |
|
199 | } |
|
200 | } |
|
201 | ||
202 | $relatedEntities = []; |
|
203 | foreach ($this->with as $relatedEntityName => $cascadeWith) { |