Skip to content

Commit 30d161c

Browse files
committed
bug symfony#20499 [Doctrine][Form] support large integers (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- [Doctrine][Form] support large integers | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#15642 | License | MIT | Doc PR | n/a Commits ------- 6954a07 [Doctrine][Form] support large integers
2 parents 9c82a9b + 6954a07 commit 30d161c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getEntitiesByIds($identifier, array $values)
104104
// Filter out non-integer values (e.g. ""). If we don't, some
105105
// databases such as PostgreSQL fail.
106106
$values = array_values(array_filter($values, function ($v) {
107-
return (string) $v === (string) (int) $v;
107+
return (string) $v === (string) (int) $v || ctype_digit($v);
108108
}));
109109
} elseif ('guid' === $metadata->getTypeOfField($identifier)) {
110110
$parameterType = Connection::PARAM_STR_ARRAY;

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testFilterNonIntegerValues()
8787

8888
$query->expects($this->once())
8989
->method('setParameter')
90-
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3), Connection::PARAM_INT_ARRAY)
90+
->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3, '9223372036854775808'), Connection::PARAM_INT_ARRAY)
9191
->willReturn($query);
9292

9393
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
@@ -103,7 +103,7 @@ public function testFilterNonIntegerValues()
103103
->from('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', 'e');
104104

105105
$loader = new ORMQueryBuilderLoader($qb);
106-
$loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo'));
106+
$loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo', '9223372036854775808'));
107107
}
108108

109109
public function testEmbeddedIdentifierName()

0 commit comments

Comments
 (0)