8000 bug #46282 [DoctrineBridge] Treat firstResult === 0 like null (derrabus) · r-martins/symfony@df2d674 · GitHub
[go: up one dir, main page]

Skip to content

Commit df2d674

Browse files
bug symfony#46282 [DoctrineBridge] Treat firstResult === 0 like null (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [DoctrineBridge] Treat firstResult === 0 like null | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Doctrine ORM has changed its default value for the `firstResult` property of `Query` and `QueryBuilder` instances from `null` to `0`. Both values should be considered equal: Setting no offset or setting the offset to zero should yield the same results. This new default however confuses our `ORMQueryBuilderLoader` because it checks for `null` only. This PR intends to fix that. Commits ------- 2fef871 [DoctrineBridge] Treat firstResult === 0 like null
2 parents 932520c + 2fef871 commit df2d674

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getEntities()
5050
*/
5151
public function getEntitiesByIds($identifier, array $values)
5252
{
53-
if (null !== $this->queryBuilder->getMaxResults() || null !== $this->queryBuilder->getFirstResult()) {
53+
if (null !== $this->queryBuilder->getMaxResults() || 0 < (int) $this->queryBuilder->getFirstResult()) {
5454
// an offset or a limit would apply on results including the where clause with submitted id values
5555
// that could make invalid choices valid
5656
$choices = [];

0 commit comments

Comments
 (0)
0