Fix regression in DDC-2430.
This commit is contained in:
parent
bf9673203c
commit
eb1a162cbc
@ -65,7 +65,10 @@ class SqlExpressionVisitor extends ExpressionVisitor
|
||||
$field = $comparison->getField();
|
||||
$value = $comparison->getValue()->getValue(); // shortcut for walkValue()
|
||||
|
||||
if (isset($this->classMetadata->associationMappings[$field]) && ! is_object($value)) {
|
||||
if (isset($this->classMetadata->associationMappings[$field]) &&
|
||||
! is_object($value) &&
|
||||
! in_array($comparison->getOperator(), array(Comparison::IN, Comparison::NIN))) {
|
||||
|
||||
throw PersisterException::matchingAssocationFieldRequiresObject($this->classMetadata->name, $field);
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,30 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
|
||||
$criteria = new Criteria(
|
||||
Criteria::expr()->gte('user', $user)
|
||||
Criteria::expr()->eq('user', $user)
|
||||
);
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
$addresses = $repository->matching($criteria);
|
||||
|
||||
$this->assertEquals(1, count($addresses));
|
||||
|
||||
$addresses = new ArrayCollection($repository->findAll());
|
||||
|
||||
$this->assertEquals(1, count($addresses->matching($criteria)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-2430
|
||||
*/
|
||||
public function testMatchingCriteriaAssocationInWithArray()
|
||||
{
|
||||
list($userId, $addressId) = $this->loadAssociatedFixture();
|
||||
|
||||
$user = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $userId);
|
||||
|
||||
$criteria = new Criteria(
|
||||
Criteria::expr()->in('user', array($user))
|
||||
);
|
||||
|
||||
$repository = $this->_em->getRepository('Doctrine\Tests\Models\CMS\CmsAddress');
|
||||
|
Loading…
x
Reference in New Issue
Block a user