diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 65aae3c32..033864e70 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -22,6 +22,7 @@ namespace Doctrine\ORM\Persisters; use PDO, Doctrine\DBAL\LockMode, Doctrine\DBAL\Types\Type, + Doctrine\DBAL\Connection, Doctrine\ORM\ORMException, Doctrine\ORM\OptimisticLockException, Doctrine\ORM\EntityManager, @@ -1281,7 +1282,7 @@ class BasicEntityPersister } else { throw ORMException::unrecognizedField($field); } - $conditionSql .= ' = ?'; + $conditionSql .= (is_array($value)) ? ' IN (?)' : ' = ?'; } return $conditionSql; } @@ -1373,6 +1374,10 @@ class BasicEntityPersister if (isset($this->_class->fieldMappings[$field])) { $type = Type::getType($this->_class->fieldMappings[$field]['type'])->getBindingType(); } + if (is_array($value)) { + $type += Connection::ARRAY_PARAM_OFFSET; + } + $params[] = $value; $types[] = $type; } diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index 0c603e175..2620fc893 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -1953,14 +1953,6 @@ class UnitOfWork implements PropertyChangedListener // TODO: This is very imperformant, ignore it? $newValue = $this->em->find($assoc['targetEntity'], $associatedId); } - - // TODO: Is there a faster approach? - $this->eagerLoadingEntities[$assoc['targetEntity']] = array_merge_recursive( - $this->eagerLoadingEntities[$assoc['targetEntity']], - array_map(function($id) { - return array($id); - }, $associatedId) - ); } else { $newValue = $this->em->getProxyFactory()->getProxy($assoc['targetEntity'], $associatedId); } @@ -2012,8 +2004,6 @@ class UnitOfWork implements PropertyChangedListener } /** -<<<<<<< HEAD -======= * @return void */ public function triggerEagerLoads() @@ -2022,6 +2012,7 @@ class UnitOfWork implements PropertyChangedListener return; } + // avoid infinite recursion $eagerLoadingEntities = $this->eagerLoadingEntities; $this->eagerLoadingEntities = array(); @@ -2032,7 +2023,6 @@ class UnitOfWork implements PropertyChangedListener } /** ->>>>>>> DDC-952 - Implemented first approach for batching eager loads of ToOne associations. * Initializes (loads) an uninitialized persistent collection of an entity. * * @param PeristentCollection $collection The collection to initialize. diff --git a/lib/vendor/doctrine-dbal b/lib/vendor/doctrine-dbal index 556351d9d..9cd6df38d 160000 --- a/lib/vendor/doctrine-dbal +++ b/lib/vendor/doctrine-dbal @@ -1 +1 @@ -Subproject commit 556351d9d6b4a33506f2c1535cccee34faa65d62 +Subproject commit 9cd6df38d841abb4719286ea35a1b37aa2679f8d diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php index d4b093da9..1c7a3d171 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC633Test.php @@ -63,7 +63,7 @@ class DDC633Test extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); $appointments = $this->_em->createQuery("SELECT a FROM " . __NAMESPACE__ . "\DDC633Appointment a")->getResult(); - + foreach ($appointments AS $eagerAppointment) { $this->assertType('Doctrine\ORM\Proxy\Proxy', $eagerAppointment->patient); $this->assertTrue($eagerAppointment->patient->__isInitialized__, "Proxy should already be initialized due to eager loading!");