Skip to content

Commit

Permalink
Removing the check for _ids from the ValidCount rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Apr 29, 2016
1 parent 43adf85 commit 996082f
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/ORM/Rule/ValidCount.php
Expand Up @@ -9,15 +9,14 @@
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 3.0.0
* @since 3.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\ORM\Rule;

use Cake\Datasource\EntityInterface;
use Cake\ORM\Association;
use Cake\Validation\Validation;
use RuntimeException;

/**
* Validates the count of associated records.
Expand Down Expand Up @@ -56,15 +55,6 @@ public function __invoke(EntityInterface $entity, array $options)
return false;
}

if (isset($value['_ids'])) {
if (!is_array($value['_ids'])) {
return false;
}
$count = count($value['_ids']);
} else {
$count = count($value);
}

return Validation::comparison($count, $options['operator'], $options['count']);
return Validation::comparison(count($value), $options['operator'], $options['count']);
}
}

0 comments on commit 996082f

Please sign in to comment.