From 1e6641565e2d7be4c9091650c4d953b7fab006c6 Mon Sep 17 00:00:00 2001 From: romanb Date: Wed, 24 Feb 2010 22:05:40 +0000 Subject: [PATCH] [2.0][DDC-368] Fixed. --- .../ORM/Query/Exec/MultiTableUpdateExecutor.php | 2 +- .../ORM/Functional/ClassTableInheritanceTest.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php b/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php index 342aa5f61..92d426774 100644 --- a/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php +++ b/lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php @@ -152,7 +152,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor // Execute UPDATE statements for ($i=0, $count=count($this->_sqlStatements); $i<$count; ++$i) { - $conn->executeUpdate($this->_sqlStatements[$i], $this->_sqlParameters[$i]); + $conn->executeUpdate($this->_sqlStatements[$i], isset($this->_sqlParameters[$i]) ? $this->_sqlParameters[$i] : array()); } // Drop temporary table diff --git a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php index 31c8d2226..1ad7409dd 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ClassTableInheritanceTest.php @@ -71,7 +71,6 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->clear(); - //TODO: Test bulk UPDATE $query = $this->_em->createQuery("update Doctrine\Tests\Models\Company\CompanyEmployee p set p.name = ?1, p.department = ?2 where p.name='Guilherme Blanco' and p.salary = ?3"); $query->setParameter(1, 'NewName'); $query->setParameter(2, 'NewDepartment'); @@ -275,4 +274,18 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertFalse($mainEvent instanceof \Doctrine\ORM\Proxy\Proxy); } + /** + * @group DDC-368 + */ + public function testBulkUpdateIssueDDC368() + { + $dql = 'UPDATE Doctrine\Tests\Models\Company\CompanyEmployee AS p SET p.salary = 1'; + $this->_em->createQuery($dql)->execute(); + + $this->assertTrue(count($this->_em->createQuery( + 'SELECT count(p.id) FROM Doctrine\Tests\Models\Company\CompanyEmployee p WHERE p.salary = 1') + ->getResult()) > 0); + + } + }