Skip to content

Commit

Permalink
bug #20499 [Doctrine][Form] support large integers (xabbuh)
Browse files Browse the repository at this point in the history
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 | #15642
| License       | MIT
| Doc PR        | n/a

Commits
-------

6954a07 [Doctrine][Form] support large integers
  • Loading branch information
fabpot committed Nov 22, 2016
2 parents 9c82a9b + 6954a07 commit 30d161c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -104,7 +104,7 @@ public function getEntitiesByIds($identifier, array $values)
// 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;
Expand Down
Expand Up @@ -87,7 +87,7 @@ public function testFilterNonIntegerValues()

$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')
Expand All @@ -103,7 +103,7 @@ public function testFilterNonIntegerValues()
->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()
Expand Down

0 comments on commit 30d161c

Please sign in to comment.