Skip to content
Permalink
Browse files

don't update private variable unless repo exists. (#9009)

  • Loading branch information...
thinkingmedia authored and markstory committed Jun 20, 2016
1 parent 5add51d commit 1fb128b1ca09431d9c4102f57e3ba6bfd48b7961
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/ORM/Rule/ExistsIn.php
@@ -64,16 +64,15 @@ public function __construct($fields, $repository)
public function __invoke(EntityInterface $entity, array $options)
{
if (is_string($this->_repository)) {
$alias = $this->_repository;
$this->_repository = $options['repository']->association($alias);
if (empty($this->_repository)) {
$repository = $options['repository']->association($this->_repository);
if (empty($repository)) {
throw new RuntimeException(sprintf(
"ExistsIn rule for '%s' is invalid. The '%s' association is not defined.",
implode(', ', $this->_fields),
$alias
$this->_repository
));
}
$this->_repository = $repository;
}
$source = $target = $this->_repository;

0 comments on commit 1fb128b

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