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

Allow DateTimeInterface as parameter value

This commit is contained in:
Jan Langer 2015-03-15 13:55:44 +01:00 committed by Marco Pivetta
parent 2fb11cdf05
commit 8ac66bb608
2 changed files with 6 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,10 @@ 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;
}
/**