[Doctrine][Form] support large integers
This commit is contained in:
parent
4967ad4b90
commit
6954a07191
@ -104,7 +104,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
|
||||
// Filter out non-integer values (e.g. ""). If we don't, some
|
||||
// databases such as PostgreSQL fail.
|
||||
$values = array_values(array_filter($values, function ($v) {
|
||||
return (string) $v === (string) (int) $v;
|
||||
return (string) $v === (string) (int) $v || ctype_digit($v);
|
||||
}));
|
||||
} elseif ('guid' === $metadata->getTypeOfField($identifier)) {
|
||||
$parameterType = Connection::PARAM_STR_ARRAY;
|
||||
|
@ -87,7 +87,7 @@ class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$query->expects($this->once())
|
||||
->method('setParameter')
|
||||
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3), Connection::PARAM_INT_ARRAY)
|
||||
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3, '9223372036854775808'), Connection::PARAM_INT_ARRAY)
|
||||
->willReturn($query);
|
||||
|
||||
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
|
||||
@ -103,7 +103,7 @@ class ORMQueryBuilderLoaderTest extends \PHPUnit_Framework_TestCase
|
||||
->from('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', 'e');
|
||||
|
||||
$loader = new ORMQueryBuilderLoader($qb);
|
||||
$loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo'));
|
||||
$loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo', '9223372036854775808'));
|
||||
}
|
||||
|
||||
public function testEmbeddedIdentifierName()
|
||||
|
Reference in New Issue
Block a user