Skip to content
Permalink
Browse files

Improving the ExistsIn exception message. See #9157

  • Loading branch information...
burzum committed Jul 25, 2016
1 parent 481fbeb commit 1e05296af5e32b4d2ca765faac6fe4a05f18046b
Showing with 4 additions and 3 deletions.
  1. +3 −2 src/ORM/Rule/ExistsIn.php
  2. +1 −1 tests/TestCase/ORM/RulesCheckerIntegrationTest.php
@@ -67,9 +67,10 @@ public function __invoke(EntityInterface $entity, array $options)
$repository = $options['repository']->association($this->_repository);
if (!$repository) {
throw new RuntimeException(sprintf(
"ExistsIn rule for '%s' is invalid. The '%s' association is not defined.",
"ExistsIn rule for '%s' is invalid. '%s' is not associated with '%s'.",
implode(', ', $this->_fields),
$this->_repository
$this->_repository,
get_class($options['repository'])
));
}
$this->_repository = $repository;
@@ -568,7 +568,7 @@ public function testExistsInWithBindingKey()
*
* @group save
* @expectedException RuntimeException
* @expectedExceptionMessage ExistsIn rule for 'author_id' is invalid. The 'NotValid' association is not defined.
* @expectedExceptionMessage ExistsIn rule for 'author_id' is invalid. 'NotValid' is not associated with 'Cake\ORM\Table'.
* @return void
*/
public function testExistsInInvalidAssociation()

0 comments on commit 1e05296

Please sign in to comment.
You can’t perform that action at this time.