diff --git a/src/Model/Behavior/CounterCacheBehavior.php b/src/Model/Behavior/CounterCacheBehavior.php index 850ce23277c..f2b4d364cbf 100644 --- a/src/Model/Behavior/CounterCacheBehavior.php +++ b/src/Model/Behavior/CounterCacheBehavior.php @@ -54,7 +54,7 @@ * [ * 'Users' => [ * 'posts_published' => [ - * 'findType' => 'published' // Will be using findPublished() + * 'finder' => 'published' // Will be using findPublished() * ] * ] * ] @@ -177,17 +177,17 @@ protected function _processAssociation(Event $event, Entity $entity, Association * @return int The number of relations matching the given config and conditions */ protected function _getCount(array $config, array $conditions) { - $findType = 'all'; - if (!empty($config['findType'])) { - $findType = $config['findType']; - unset($config['findType']); + $finder = 'all'; + if (!empty($config['finder'])) { + $finder = $config['finder']; + unset($config['finder']); } if (!isset($config['conditions'])) { $config['conditions'] = []; } $config['conditions'] = array_merge($conditions, $config['conditions']); - $query = $this->_table->find($findType, $config); + $query = $this->_table->find($finder, $config); return $query->count(); } diff --git a/tests/TestCase/Model/Behavior/CounterCacheBehaviorTest.php b/tests/TestCase/Model/Behavior/CounterCacheBehaviorTest.php index fec88f9db34..cd1c4df8a7d 100644 --- a/tests/TestCase/Model/Behavior/CounterCacheBehaviorTest.php +++ b/tests/TestCase/Model/Behavior/CounterCacheBehaviorTest.php @@ -166,7 +166,7 @@ public function testCustomFind() { $this->post->addBehavior('CounterCache', [ 'Users' => [ 'posts_published' => [ - 'findType' => 'published' + 'finder' => 'published' ] ] ]);