@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | $class = get_class($db); |
79 | - $cache =& $class::$methodCache['fields']; |
|
79 | + $cache = & $class::$methodCache['fields']; |
|
80 | 80 | if (!is_array($cache) || count($cache) >= 1000) { |
81 | 81 | $cache = array(); |
82 | 82 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $db = $model->getDataSource(); |
126 | 126 | $value = $db->value($this->id); |
127 | - $name = $db->name('EagerLoaderModel' . '__' . 'id'); |
|
127 | + $name = $db->name('EagerLoaderModel'.'__'.'id'); |
|
128 | 128 | $query['fields'][] = "($value) AS $name"; |
129 | 129 | $query['callbacks'] = true; |
130 | 130 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $assocResults = array_merge($assocResults, $eachAssocResults); |
256 | 256 | } |
257 | 257 | } else { |
258 | - $options['fields'][] = '(' . $db->name($assocAlias . '.' . $assocKey) . ') AS ' . $db->name('EagerLoaderModel' . '__' . 'assoc_id'); |
|
258 | + $options['fields'][] = '('.$db->name($assocAlias.'.'.$assocKey).') AS '.$db->name('EagerLoaderModel'.'__'.'assoc_id'); |
|
259 | 259 | $options['conditions'][] = array("$assocAlias.$assocKey" => $ids); |
260 | 260 | $assocResults = $db->read($target, $options); |
261 | 261 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | $assoc = array(); |
280 | 280 | foreach ($assocResults as $assocResult) { |
281 | - if ((string)$result[$parentAlias][$parentKey] === (string)$assocResult['EagerLoaderModel']['assoc_id']) { |
|
281 | + if ((string) $result[$parentAlias][$parentKey] === (string) $assocResult['EagerLoaderModel']['assoc_id']) { |
|
282 | 282 | $assoc[] = $assocResult[$alias]; |
283 | 283 | } |
284 | 284 | } |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | if ($result[$alias][$targetKey] === null) { |
308 | 308 | // Remove NULL association created by LEFT JOIN |
309 | 309 | if (empty($eager)) { |
310 | - $assocResults[$n] = array( $alias => array() ); |
|
310 | + $assocResults[$n] = array($alias => array()); |
|
311 | 311 | } |
312 | 312 | } else { |
313 | - $assocResults[$n] = array( $alias => $result[$alias] ); |
|
313 | + $assocResults[$n] = array($alias => $result[$alias]); |
|
314 | 314 | } |
315 | 315 | unset($result[$alias]); |
316 | 316 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @return array |
342 | 342 | */ |
343 | 343 | private function mergeAssocResult(array $result, array $assoc, $propertyPath) { // @codingStandardsIgnoreLine |
344 | - return Hash::insert($result, $propertyPath, $assoc + (array)Hash::get($result, $propertyPath)); |
|
344 | + return Hash::insert($result, $propertyPath, $assoc + (array) Hash::get($result, $propertyPath)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | 'contain' => array(), |
357 | 357 | ); |
358 | 358 | |
359 | - $contain = (array)$contain; |
|
359 | + $contain = (array) $contain; |
|
360 | 360 | foreach ($contain as $key => $val) { |
361 | 361 | if (is_int($key)) { |
362 | 362 | $key = $val; |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | $expanded = Hash::expand(array($key => $val)); |
369 | 369 | list($key, $val) = each($expanded); |
370 | 370 | } |
371 | - $ref =& $result['contain'][$key]; |
|
372 | - $ref = Hash::merge((array)$ref, $this->reformatContain($val)); |
|
371 | + $ref = & $result['contain'][$key]; |
|
372 | + $ref = Hash::merge((array) $ref, $this->reformatContain($val)); |
|
373 | 373 | } else { |
374 | 374 | $result['options'][$key] = $val; |
375 | 375 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $query['fields'] = $db->fields($model, null, array(), false); |
399 | 399 | } |
400 | 400 | |
401 | - $query['fields'] = (array)$query['fields']; |
|
401 | + $query['fields'] = (array) $query['fields']; |
|
402 | 402 | foreach ($query['fields'] as &$field) { |
403 | 403 | if ($model->isVirtualField($field)) { |
404 | 404 | $fields = $db->fields($model, null, array($field), false); |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | } |
410 | 410 | unset($field); |
411 | 411 | |
412 | - $query['conditions'] = (array)$query['conditions']; |
|
412 | + $query['conditions'] = (array) $query['conditions']; |
|
413 | 413 | foreach ($query['conditions'] as $key => $val) { |
414 | 414 | if ($model->hasField($key)) { |
415 | 415 | unset($query['conditions'][$key]); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | $order = array(); |
426 | - foreach ((array)$query['order'] as $key => $val) { |
|
426 | + foreach ((array) $query['order'] as $key => $val) { |
|
427 | 427 | if (is_int($key)) { |
428 | 428 | $val = $this->normalizeField($model, $val); |
429 | 429 | } else { |
@@ -445,12 +445,12 @@ discard block |
||
445 | 445 | */ |
446 | 446 | private function normalizeField(Model $model, $field) { // @codingStandardsIgnoreLine |
447 | 447 | if ($model->hasField($field)) { |
448 | - $field = $model->alias . '.' . $field; |
|
448 | + $field = $model->alias.'.'.$field; |
|
449 | 449 | } elseif ($model->isVirtualField($field)) { |
450 | 450 | $db = $model->getDataSource(); |
451 | 451 | $field = $model->getVirtualField($field); |
452 | 452 | $field = $db->dispatchMethod('_quoteFields', array($field)); |
453 | - $field = '(' . $field . ')'; |
|
453 | + $field = '('.$field.')'; |
|
454 | 454 | } |
455 | 455 | return $field; |
456 | 456 | } |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | ); |
522 | 522 | } |
523 | 523 | |
524 | - $aliasPath = $context['aliasPath'] . '.' . $alias; |
|
525 | - $propertyPath = ($context['propertyPath'] ? $context['propertyPath'] . '.' : '') . $alias; |
|
524 | + $aliasPath = $context['aliasPath'].'.'.$alias; |
|
525 | + $propertyPath = ($context['propertyPath'] ? $context['propertyPath'].'.' : '').$alias; |
|
526 | 526 | |
527 | 527 | $types = $parent->getAssociated(); |
528 | 528 | if (!isset($types[$alias])) { |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | ); |
573 | 573 | |
574 | 574 | if ($this->isExternal($context, $meta)) { |
575 | - $meta['propertyPath'] = ($context['propertyPath'] ? $parentAlias . '.' : '') . $alias; |
|
575 | + $meta['propertyPath'] = ($context['propertyPath'] ? $parentAlias.'.' : '').$alias; |
|
576 | 576 | $meta['external'] = true; |
577 | 577 | |
578 | 578 | $context['root'] = $aliasPath; |