From 43ef8765fd9a3ee6bab5ff8d90af8056c8870d8d Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 12 Dec 2011 16:39:52 +0100 Subject: [PATCH] DDC-1527 - Port bugfix for master branch --- lib/Doctrine/ORM/Persisters/BasicEntityPersister.php | 6 +++--- tests/Doctrine/Tests/ORM/Functional/TypeTest.php | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index e94e91575..08f316fb3 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -1433,7 +1433,7 @@ class BasicEntityPersister { switch (true) { case (isset($this->_class->fieldMappings[$field])): - $type = Type::getType($this->_class->fieldMappings[$field]['type'])->getBindingType(); + $type = $this->_class->fieldMappings[$field]['type']; break; case (isset($this->_class->associationMappings[$field])): @@ -1448,7 +1448,7 @@ class BasicEntityPersister $type = null; if (isset($targetClass->fieldNames[$targetColumn])) { - $type = Type::getType($targetClass->fieldMappings[$targetClass->fieldNames[$targetColumn]]['type'])->getBindingType(); + $type = $targetClass->fieldMappings[$targetClass->fieldNames[$targetColumn]]['type']; } break; @@ -1456,8 +1456,8 @@ class BasicEntityPersister default: $type = null; } - if (is_array($value)) { + $type = Type::getType( $type )->getBindingType(); $type += Connection::ARRAY_PARAM_OFFSET; } diff --git a/tests/Doctrine/Tests/ORM/Functional/TypeTest.php b/tests/Doctrine/Tests/ORM/Functional/TypeTest.php index 8a2eab70e..9ed8cf050 100644 --- a/tests/Doctrine/Tests/ORM/Functional/TypeTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/TypeTest.php @@ -125,6 +125,9 @@ class TypeTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertInstanceOf('DateTime', $dateTimeDb->datetime); $this->assertEquals('2009-10-02 20:10:52', $dateTimeDb->datetime->format('Y-m-d H:i:s')); + + $articles = $this->_em->getRepository( 'Doctrine\Tests\Models\Generic\DateTimeModel' )->findBy( array( 'datetime' => new \DateTime( "now" ) ) ); + $this->assertEquals( 0, count( $articles ) ); } public function testDqlQueryBindDateTimeInstance() @@ -176,4 +179,4 @@ class TypeTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertInstanceOf('DateTime', $dateTime->time); $this->assertEquals('19:27:20', $dateTime->time->format('H:i:s')); } -} \ No newline at end of file +}