Completed
Push — master ( 7479de...5cab93 )
by Kurita
02:49
created
Test/test_app/Model/Behavior/QueryCounterBehavior.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Test/bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 App::build(array(
3
-	'Model' => array(App::pluginPath('EagerLoader') . 'Test' . DS . 'test_app' . DS . 'Model' . DS),
4
-	'Model/Behavior' => array(App::pluginPath('EagerLoader') . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Behavior' . DS),
3
+	'Model' => array(App::pluginPath('EagerLoader').'Test'.DS.'test_app'.DS.'Model'.DS),
4
+	'Model/Behavior' => array(App::pluginPath('EagerLoader').'Test'.DS.'test_app'.DS.'Model'.DS.'Behavior'.DS),
5 5
 ), true);
6 6
 
7 7
 App::uses('ConnectionManager', 'Model');
8 8
 ConnectionManager::create('test_external', array(
9 9
 	'datasource' => 'Database/Sqlite',
10
-	'database' => TMP . 'tests' . DS . 'test_external.db',
10
+	'database' => TMP.'tests'.DS.'test_external.db',
11 11
 ))->cacheSources = false;
Please login to merge, or discard this patch.
Test/Case/Model/Behavior/EagerLoaderBehaviorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-require_once App::pluginPath('EagerLoader') . 'Test' . DS . 'bootstrap.php';
2
+require_once App::pluginPath('EagerLoader').'Test'.DS.'bootstrap.php';
3 3
 
4 4
 class EagerLoaderBehaviorTest extends CakeTestCase {
5 5
 
Please login to merge, or discard this patch.
Test/Case/Model/EagerLoaderTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once App::pluginPath('EagerLoader') . 'Test' . DS . 'bootstrap.php';
2
+require_once App::pluginPath('EagerLoader').'Test'.DS.'bootstrap.php';
3 3
 
4 4
 App::uses('EagerLoader', 'EagerLoader.Model');
5 5
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					'alias' => 'User',
192 192
 					'conditions' => array(
193 193
 						array('Article.user_id' => array(1, 2, 3)),
194
-						array('Article.user_id' => (object)array('type' => 'identifier', 'value' => 'User.id')),
194
+						array('Article.user_id' => (object) array('type' => 'identifier', 'value' => 'User.id')),
195 195
 					),
196 196
 				),
197 197
 			),
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 						'(CASE WHEN Category.parent_id = 0 THEN 1 ELSE 0 END) AS  Category__is_root',
792 792
 					),
793 793
 					'conditions' => array(
794
-						(object)array(
794
+						(object) array(
795 795
 							'type' => 'expression',
796 796
 							'value' => '(CASE WHEN Category.parent_id = 0 THEN 1 ELSE 0 END) = 0',
797 797
 						)
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
 			'target' => $target,
831 831
 			'alias' => $target->alias,
832 832
 			'parentAlias' => $parent->alias,
833
-			'aliasPath' => $parent->alias . '.' . $target->alias,
834
-			'propertyPath' => $parent->alias . '.' . $target->alias,
833
+			'aliasPath' => $parent->alias.'.'.$target->alias,
834
+			'propertyPath' => $parent->alias.'.'.$target->alias,
835 835
 		);
836 836
 
837 837
 		if (isset($meta['habtmAlias'])) {
Please login to merge, or discard this patch.
Test/Case/AllEagerLoaderTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  */
12 12
 	public static function suite() {
13 13
 		$suite = new CakeTestSuite('All Tests');
14
-		$suite->addTestDirectoryRecursive(App::pluginPath('EagerLoader') . 'Test' . DS . 'Case' . DS);
14
+		$suite->addTestDirectoryRecursive(App::pluginPath('EagerLoader').'Test'.DS.'Case'.DS);
15 15
 		return $suite;
16 16
 	}
17 17
 
Please login to merge, or discard this patch.
Model/EagerLoader.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.