@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $db = $model->getDataSource(); |
| 109 | 109 | $value = $db->value($this->id); |
| 110 | - $name = $db->name('EagerLoaderModel' . '__' . 'id'); |
|
| 110 | + $name = $db->name('EagerLoaderModel'.'__'.'id'); |
|
| 111 | 111 | $query['fields'][] = "($value) AS $name"; |
| 112 | 112 | $query['callbacks'] = true; |
| 113 | 113 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $assocResults = array_merge($assocResults, $eachAssocResults); |
| 239 | 239 | } |
| 240 | 240 | } else { |
| 241 | - $options['fields'][] = '(' . $db->name($assocAlias . '.' . $assocKey) . ') AS ' . $db->name('EagerLoaderModel' . '__' . 'assoc_id'); |
|
| 241 | + $options['fields'][] = '('.$db->name($assocAlias.'.'.$assocKey).') AS '.$db->name('EagerLoaderModel'.'__'.'assoc_id'); |
|
| 242 | 242 | $options['conditions'][] = array("$assocAlias.$assocKey" => $ids); |
| 243 | 243 | $assocResults = $db->read($target, $options); |
| 244 | 244 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $assoc = array(); |
| 263 | 263 | foreach ($assocResults as $assocResult) { |
| 264 | - if ((string)$result[$parentAlias][$parentKey] === (string)$assocResult['EagerLoaderModel']['assoc_id']) { |
|
| 264 | + if ((string) $result[$parentAlias][$parentKey] === (string) $assocResult['EagerLoaderModel']['assoc_id']) { |
|
| 265 | 265 | $assoc[] = $assocResult[$alias]; |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | if ($result[$alias][$targetKey] === null) { |
| 291 | 291 | // Remove NULL association created by LEFT JOIN |
| 292 | 292 | if (empty($eager)) { |
| 293 | - $assocResults[$n] = array( $alias => array() ); |
|
| 293 | + $assocResults[$n] = array($alias => array()); |
|
| 294 | 294 | } |
| 295 | 295 | } else { |
| 296 | - $assocResults[$n] = array( $alias => $result[$alias] ); |
|
| 296 | + $assocResults[$n] = array($alias => $result[$alias]); |
|
| 297 | 297 | } |
| 298 | 298 | unset($result[$alias]); |
| 299 | 299 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @return array |
| 325 | 325 | */ |
| 326 | 326 | private function mergeAssocResult(array $result, array $assoc, $propertyPath) { // @codingStandardsIgnoreLine |
| 327 | - return Hash::insert($result, $propertyPath, $assoc + (array)Hash::get($result, $propertyPath)); |
|
| 327 | + return Hash::insert($result, $propertyPath, $assoc + (array) Hash::get($result, $propertyPath)); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | 'contain' => array(), |
| 340 | 340 | ); |
| 341 | 341 | |
| 342 | - $contain = (array)$contain; |
|
| 342 | + $contain = (array) $contain; |
|
| 343 | 343 | foreach ($contain as $key => $val) { |
| 344 | 344 | if (is_int($key)) { |
| 345 | 345 | $key = $val; |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | $expanded = Hash::expand(array($key => $val)); |
| 352 | 352 | list($key, $val) = each($expanded); |
| 353 | 353 | } |
| 354 | - $ref =& $result['contain'][$key]; |
|
| 355 | - $ref = Hash::merge((array)$ref, $this->reformatContain($val)); |
|
| 354 | + $ref = & $result['contain'][$key]; |
|
| 355 | + $ref = Hash::merge((array) $ref, $this->reformatContain($val)); |
|
| 356 | 356 | } else { |
| 357 | 357 | $result['options'][$key] = $val; |
| 358 | 358 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | $query['fields'] = $db->fields($model, null, array(), false); |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | - $query['fields'] = (array)$query['fields']; |
|
| 384 | + $query['fields'] = (array) $query['fields']; |
|
| 385 | 385 | foreach ($query['fields'] as &$field) { |
| 386 | 386 | if ($model->isVirtualField($field)) { |
| 387 | 387 | $fields = $db->fields($model, null, array($field), false); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | unset($field); |
| 394 | 394 | |
| 395 | - $query['conditions'] = (array)$query['conditions']; |
|
| 395 | + $query['conditions'] = (array) $query['conditions']; |
|
| 396 | 396 | foreach ($query['conditions'] as $key => $val) { |
| 397 | 397 | if ($model->hasField($key)) { |
| 398 | 398 | unset($query['conditions'][$key]); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | $order = array(); |
| 409 | - foreach ((array)$query['order'] as $key => $val) { |
|
| 409 | + foreach ((array) $query['order'] as $key => $val) { |
|
| 410 | 410 | if (is_int($key)) { |
| 411 | 411 | $val = $this->normalizeField($model, $val); |
| 412 | 412 | } else { |
@@ -428,12 +428,12 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | private function normalizeField(Model $model, $field) { // @codingStandardsIgnoreLine |
| 430 | 430 | if ($model->hasField($field)) { |
| 431 | - $field = $model->alias . '.' . $field; |
|
| 431 | + $field = $model->alias.'.'.$field; |
|
| 432 | 432 | } elseif ($model->isVirtualField($field)) { |
| 433 | 433 | $db = $model->getDataSource(); |
| 434 | 434 | $field = $model->getVirtualField($field); |
| 435 | 435 | $field = $db->dispatchMethod('_quoteFields', array($field)); |
| 436 | - $field = '(' . $field . ')'; |
|
| 436 | + $field = '('.$field.')'; |
|
| 437 | 437 | } |
| 438 | 438 | return $field; |
| 439 | 439 | } |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | ); |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - $aliasPath = $context['aliasPath'] . '.' . $alias; |
|
| 508 | - $propertyPath = ($context['propertyPath'] ? $context['propertyPath'] . '.' : '') . $alias; |
|
| 507 | + $aliasPath = $context['aliasPath'].'.'.$alias; |
|
| 508 | + $propertyPath = ($context['propertyPath'] ? $context['propertyPath'].'.' : '').$alias; |
|
| 509 | 509 | |
| 510 | 510 | $types = $parent->getAssociated(); |
| 511 | 511 | if (!isset($types[$alias])) { |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | ); |
| 556 | 556 | |
| 557 | 557 | if ($this->isExternal($context, $meta)) { |
| 558 | - $meta['propertyPath'] = ($context['propertyPath'] ? $parentAlias . '.' : '') . $alias; |
|
| 558 | + $meta['propertyPath'] = ($context['propertyPath'] ? $parentAlias.'.' : '').$alias; |
|
| 559 | 559 | $meta['external'] = true; |
| 560 | 560 | |
| 561 | 561 | $context['root'] = $aliasPath; |