@@ -13,8 +13,11 @@ |
||
| 13 | 13 | foreach ($arr as $k => $v){ |
| 14 | 14 | $key = $k; |
| 15 | 15 | if ($kfield!==null) { |
| 16 | - if (is_array($v) && isset($v[$kfield])) $key = $v[$kfield]; |
|
| 17 | - elseif (is_object($v) && isset($v->$kfield)) $key = $v->$kfield; |
|
| 16 | + if (is_array($v) && isset($v[$kfield])) { |
|
| 17 | + $key = $v[$kfield]; |
|
| 18 | + } elseif (is_object($v) && isset($v->$kfield)) { |
|
| 19 | + $key = $v->$kfield; |
|
| 20 | + } |
|
| 18 | 21 | } |
| 19 | 22 | $result[$key] = $v; |
| 20 | 23 | } |
@@ -58,7 +58,9 @@ discard block |
||
| 58 | 58 | private $relationsPrepared = false; |
| 59 | 59 | |
| 60 | 60 | public function prepareEagerRelations() { |
| 61 | - if($this->relationsPrepared) return; |
|
| 61 | + if($this->relationsPrepared) { |
|
| 62 | + return; |
|
| 63 | + } |
|
| 62 | 64 | $this->relationsPrepared = true; |
| 63 | 65 | $localClass = $this->dataClass(); |
| 64 | 66 | $config = Config::forClass($localClass); |
@@ -206,7 +208,9 @@ discard block |
||
| 206 | 208 | foreach($idsQuery as $row){ |
| 207 | 209 | $relID = $row[$component['childField']]; |
| 208 | 210 | $localID = $row[$component['parentField']]; |
| 209 | - if(!isset($collection[$localID])) $collection[$localID] = []; |
|
| 211 | + if(!isset($collection[$localID])) { |
|
| 212 | + $collection[$localID] = []; |
|
| 213 | + } |
|
| 210 | 214 | $collection[$localID][] = $relID; |
| 211 | 215 | $relListReverted[$relID] = 1;//use ids as keys to avoid |
| 212 | 216 | } |