@@ -9,7 +9,7 @@ |
||
| 9 | 9 | * |
| 10 | 10 | * @param Model $model Model |
| 11 | 11 | * @param array $query Query |
| 12 | - * @return mixed |
|
| 12 | + * @return boolean |
|
| 13 | 13 | */ |
| 14 | 14 | public function beforeFind(Model $model, $query) { |
| 15 | 15 | $db = $model->getDataSource(); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * EagerLoader class |
|
| 4 | - * |
|
| 5 | - * @internal |
|
| 6 | - */ |
|
| 3 | + * EagerLoader class |
|
| 4 | + * |
|
| 5 | + * @internal |
|
| 6 | + */ |
|
| 7 | 7 | class EagerLoader { |
| 8 | 8 | |
| 9 | 9 | private static $handlers = array(); // @codingStandardsIgnoreLine |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | foreach ($results as &$result) { |
| 263 | 263 | $assoc = array(); |
| 264 | 264 | foreach ($assocResults as $assocResult) { |
| 265 | - if ((string)$result[$parentAlias][$parentKey] === (string)$assocResult['EagerLoaderModel']['assoc_id']) { |
|
| 265 | + if ((string) $result[$parentAlias][$parentKey] === (string) $assocResult['EagerLoaderModel']['assoc_id']) { |
|
| 266 | 266 | $assoc[] = $assocResult[$alias]; |
| 267 | 267 | } |
| 268 | 268 | } |
@@ -291,10 +291,10 @@ discard block |
||
| 291 | 291 | if ($result[$alias][$targetKey] === null) { |
| 292 | 292 | // Remove NULL association created by LEFT JOIN |
| 293 | 293 | if (empty($eager)) { |
| 294 | - $assocResults[$n] = array( $alias => array() ); |
|
| 294 | + $assocResults[$n] = array($alias => array()); |
|
| 295 | 295 | } |
| 296 | 296 | } else { |
| 297 | - $assocResults[$n] = array( $alias => $result[$alias] ); |
|
| 297 | + $assocResults[$n] = array($alias => $result[$alias]); |
|
| 298 | 298 | } |
| 299 | 299 | unset($result[$alias]); |
| 300 | 300 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * @return array |
| 326 | 326 | */ |
| 327 | 327 | private function mergeAssocResult(array $result, array $assoc, $propertyPath) { // @codingStandardsIgnoreLine |
| 328 | - return Hash::insert($result, $propertyPath, $assoc + (array)Hash::get($result, $propertyPath)); |
|
| 328 | + return Hash::insert($result, $propertyPath, $assoc + (array) Hash::get($result, $propertyPath)); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'contain' => array(), |
| 341 | 341 | ); |
| 342 | 342 | |
| 343 | - $contain = (array)$contain; |
|
| 343 | + $contain = (array) $contain; |
|
| 344 | 344 | foreach ($contain as $key => $val) { |
| 345 | 345 | if (is_int($key)) { |
| 346 | 346 | $key = $val; |
@@ -352,8 +352,8 @@ discard block |
||
| 352 | 352 | $expanded = Hash::expand(array($key => $val)); |
| 353 | 353 | list($key, $val) = each($expanded); |
| 354 | 354 | } |
| 355 | - $ref =& $result['contain'][$key]; |
|
| 356 | - $ref = Hash::merge((array)$ref, $this->reformatContain($val)); |
|
| 355 | + $ref = & $result['contain'][$key]; |
|
| 356 | + $ref = Hash::merge((array) $ref, $this->reformatContain($val)); |
|
| 357 | 357 | } else { |
| 358 | 358 | $result['options'][$key] = $val; |
| 359 | 359 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | $query['fields'] = $db->fields($model, null, array(), false); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - $query['fields'] = (array)$query['fields']; |
|
| 385 | + $query['fields'] = (array) $query['fields']; |
|
| 386 | 386 | foreach ($query['fields'] as &$field) { |
| 387 | 387 | if ($model->isVirtualField($field)) { |
| 388 | 388 | $fields = $db->fields($model, null, array($field), false); |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | unset($field); |
| 395 | 395 | |
| 396 | - $query['conditions'] = (array)$query['conditions']; |
|
| 396 | + $query['conditions'] = (array) $query['conditions']; |
|
| 397 | 397 | foreach ($query['conditions'] as $key => $val) { |
| 398 | 398 | if ($model->hasField($key)) { |
| 399 | 399 | unset($query['conditions'][$key]); |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | $order = array(); |
| 410 | - foreach ((array)$query['order'] as $key => $val) { |
|
| 410 | + foreach ((array) $query['order'] as $key => $val) { |
|
| 411 | 411 | if (is_int($key)) { |
| 412 | 412 | $val = $this->normalizeField($model, $val); |
| 413 | 413 | } else { |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * EagerLoaderModel class |
|
| 4 | - * |
|
| 5 | - * @internal |
|
| 6 | - */ |
|
| 3 | + * EagerLoaderModel class |
|
| 4 | + * |
|
| 5 | + * @internal |
|
| 6 | + */ |
|
| 7 | 7 | class EagerLoaderModel extends Model { |
| 8 | 8 | |
| 9 | 9 | public $useTable = false; |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * All EagerLoader plugin tests |
|
| 4 | - */ |
|
| 3 | + * All EagerLoader plugin tests |
|
| 4 | + */ |
|
| 5 | 5 | class AllEagerLoaderTest extends PHPUnit_Framework_TestSuite { |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | 'alias' => 'User', |
| 201 | 201 | 'conditions' => array( |
| 202 | 202 | array('Article.user_id' => array(1, 2, 3)), |
| 203 | - array('Article.user_id' => (object)array('type' => 'identifier', 'value' => 'User.id')), |
|
| 203 | + array('Article.user_id' => (object) array('type' => 'identifier', 'value' => 'User.id')), |
|
| 204 | 204 | ), |
| 205 | 205 | ), |
| 206 | 206 | ), |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | '(CASE WHEN Category.parent_id = 0 THEN 1 ELSE 0 END) AS Category__is_root', |
| 801 | 801 | ), |
| 802 | 802 | 'conditions' => array( |
| 803 | - (object)array( |
|
| 803 | + (object) array( |
|
| 804 | 804 | 'type' => 'expression', |
| 805 | 805 | 'value' => '(CASE WHEN Category.parent_id = 0 THEN 1 ELSE 0 END) = 0', |
| 806 | 806 | ) |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * AppModel for testing |
|
| 4 | - */ |
|
| 3 | + * AppModel for testing |
|
| 4 | + */ |
|
| 5 | 5 | class AppModel extends CakeTestModel { |
| 6 | 6 | |
| 7 | 7 | public $actsAs = array( |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Article for testing |
|
| 4 | - */ |
|
| 3 | + * Article for testing |
|
| 4 | + */ |
|
| 5 | 5 | class Article extends AppModel { |
| 6 | 6 | |
| 7 | 7 | public $hasMany = array('Comment', 'ExternalComment'); |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Attachment for testing |
|
| 4 | - */ |
|
| 3 | + * Attachment for testing |
|
| 4 | + */ |
|
| 5 | 5 | class Attachment extends AppModel { |
| 6 | 6 | |
| 7 | 7 | public $displayField = 'attachment'; |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Comment for testing |
|
| 4 | - */ |
|
| 3 | + * Comment for testing |
|
| 4 | + */ |
|
| 5 | 5 | class Comment extends AppModel { |
| 6 | 6 | |
| 7 | 7 | public $displayField = 'comment'; |