[PR #7903] [Paginator] Fix regression when using Custom ID type #10703

Open
opened 2026-01-22 16:08:24 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/7903

State: closed
Merged: No


Continuation of https://github.com/doctrine/orm/pull/7890. Created new PR to clean the mess with huge diff, though I still left attributions via co-authors.

I have reused previous code from @Ocramius for getting id type, however if preferred, I can replace it with this smaller piece of code:

$AST           = $subQuery->getAST();
$entityManager = $subQuery->getEntityManager();
$connection    = $this->query->getEntityManager()->getConnection();
$classMetadata = $entityManager->getClassMetadata(
    $AST->fromClause->identificationVariableDeclarations[0]->rangeVariableDeclaration->abstractSchemaName
);

$identifierType = PersisterHelper::getTypeOfField(
    $classMetadata->getSingleIdentifierFieldName(),
    $classMetadata,
    $entityManager
)[0];

$ids =  array_map(static function(array $row) use ($identifierType, $connection) {
    return current($row);
    return $connection->convertToPHPValue(current($row), $identifierType);
}, $foundIdRows);

Please check if this approach is right one, as it's weird that we are now doing PHP<>DB conversions in both Paginator and WhereInWalker

**Original Pull Request:** https://github.com/doctrine/orm/pull/7903 **State:** closed **Merged:** No --- Continuation of https://github.com/doctrine/orm/pull/7890. Created new PR to clean the mess with huge diff, though I still left attributions via co-authors. I have reused previous code from @Ocramius for getting id type, however if preferred, I can replace it with this smaller piece of code: ```php $AST = $subQuery->getAST(); $entityManager = $subQuery->getEntityManager(); $connection = $this->query->getEntityManager()->getConnection(); $classMetadata = $entityManager->getClassMetadata( $AST->fromClause->identificationVariableDeclarations[0]->rangeVariableDeclaration->abstractSchemaName ); $identifierType = PersisterHelper::getTypeOfField( $classMetadata->getSingleIdentifierFieldName(), $classMetadata, $entityManager )[0]; $ids = array_map(static function(array $row) use ($identifierType, $connection) { return current($row); return $connection->convertToPHPValue(current($row), $identifierType); }, $foundIdRows); ``` Please check if this approach is right one, as it's weird that we are now doing PHP<>DB conversions in both Paginator and WhereInWalker
admin added the pull-request label 2026-01-22 16:08:24 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#10703