Completed
Push — master ( 573d7b...3a99ef )
by Kurita
03:04
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
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 		$db = $model->getDataSource();
114 114
 		$value = $db->value($this->id);
115
-		$name = $db->name('EagerLoaderModel' . '__' . 'id');
115
+		$name = $db->name('EagerLoaderModel'.'__'.'id');
116 116
 		$query['fields'][] = "($value) AS $name";
117 117
 		$query['callbacks'] = true;
118 118
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				$assocResults = array_merge($assocResults, $eachAssocResults);
244 244
 			}
245 245
 		} else {
246
-			$options['fields'][] = '(' . $db->name($assocAlias . '.' . $assocKey) . ') AS ' . $db->name('EagerLoaderModel' . '__' . 'assoc_id');
246
+			$options['fields'][] = '('.$db->name($assocAlias.'.'.$assocKey).') AS '.$db->name('EagerLoaderModel'.'__'.'assoc_id');
247 247
 			$options['conditions'][] = array("$assocAlias.$assocKey" => $ids);
248 248
 			$assocResults = $db->read($target, $options);
249 249
 		}
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 {
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
  */
430 430
 	private function normalizeField(Model $model, $field) { // @codingStandardsIgnoreLine
431 431
 		if ($model->hasField($field)) {
432
-			$field = $model->alias . '.' . $field;
432
+			$field = $model->alias.'.'.$field;
433 433
 		} elseif ($model->isVirtualField($field)) {
434 434
 			$db = $model->getDataSource();
435 435
 			$field = $model->getVirtualField($field);
436 436
 			$field = $db->dispatchMethod('_quoteFields', array($field));
437
-			$field = '(' . $field . ')';
437
+			$field = '('.$field.')';
438 438
 		}
439 439
 		return $field;
440 440
 	}
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
 			);
506 506
 		}
507 507
 
508
-		$aliasPath = $context['aliasPath'] . '.' . $alias;
509
-		$propertyPath = ($context['propertyPath'] ? $context['propertyPath'] . '.' : '') . $alias;
508
+		$aliasPath = $context['aliasPath'].'.'.$alias;
509
+		$propertyPath = ($context['propertyPath'] ? $context['propertyPath'].'.' : '').$alias;
510 510
 
511 511
 		$types = $parent->getAssociated();
512 512
 		if (!isset($types[$alias])) {
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 		);
557 557
 
558 558
 		if ($this->isExternal($context, $meta)) {
559
-			$meta['propertyPath'] = ($context['propertyPath'] ? $parentAlias . '.' : '') . $alias;
559
+			$meta['propertyPath'] = ($context['propertyPath'] ? $parentAlias.'.' : '').$alias;
560 560
 			$meta['external'] = true;
561 561
 
562 562
 			$context['root'] = $aliasPath;
Please login to merge, or discard this patch.