From 59c6449076241e052b1dc8e6b404a1ee829bcecc Mon Sep 17 00:00:00 2001 From: beberlei Date: Mon, 7 Dec 2009 21:20:04 +0000 Subject: [PATCH] [2.0] DDC-168 - Add test-case that proves that the order of reflFields matters for inserting, which causes problems with caching. --- .../ORM/Functional/Ticket/DDC168Test.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php new file mode 100644 index 000000000..a90111226 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC168Test.php @@ -0,0 +1,40 @@ +useModelSet('company'); + parent::setUp(); + } + + public function testJoinedSubclassPersisterRequiresSpecificOrderOfMetadataReflFieldsArray() + { + $metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyEmployee'); + ksort($metadata->reflFields); + + $spouse = new \Doctrine\Tests\Models\Company\CompanyEmployee(); + $spouse->setName("Blub"); + + $employee = new \Doctrine\Tests\Models\Company\CompanyEmployee(); + $employee->setName("Foo"); + $employee->setDepartment("bar"); + $employee->setSalary(1000); + $employee->setSpouse($spouse); + + $this->_em->persist($spouse); + $this->_em->persist($employee); + + $this->_em->flush(); + $this->_em->clear(); + + $q = $this->_em->createQuery("SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e WHERE e.name = ?1"); + $q->setParameter(1, "Foo"); + $theEmployee = $q->getSingleResult(); + + $this->assertEquals("bar", $theEmployee->getDepartment()); + } +} \ No newline at end of file