1
0
mirror of synced 2024-12-05 03:06:05 +03:00

Merge branch 'hotfix/#1333-datetime-immutable-dql-parameter-inference'

Close #1333
This commit is contained in:
Marco Pivetta 2015-03-17 21:01:05 +00:00
commit 32137c72e4
2 changed files with 8 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class ParameterTypeInferer
return Type::BOOLEAN;
}
if ($value instanceof \DateTime) {
if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) {
return Type::DATETIME;
}

View File

@ -28,7 +28,7 @@ class ParameterTypeInfererTest extends \Doctrine\Tests\OrmTestCase
public function providerParameterTypeInferer()
{
return array(
$data = array(
array(1, Type::INTEGER),
array("bar", PDO::PARAM_STR),
array("1", PDO::PARAM_STR),
@ -39,6 +39,12 @@ class ParameterTypeInfererTest extends \Doctrine\Tests\OrmTestCase
array(array(), Connection::PARAM_STR_ARRAY),
array(true, Type::BOOLEAN),
);
if (PHP_VERSION_ID >= 50500) {
$data[] = array(new \DateTimeImmutable(), Type::DATETIME);
}
return $data;
}
/**