Merge branch 'hotfix/#1333-datetime-immutable-dql-parameter-inference'
Close #1333
This commit is contained in:
commit
32137c72e4
@ -53,7 +53,7 @@ class ParameterTypeInferer
|
||||
return Type::BOOLEAN;
|
||||
}
|
||||
|
||||
if ($value instanceof \DateTime) {
|
||||
if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) {
|
||||
return Type::DATETIME;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user