[PR #12095] Performance optimization in ScalarColumnHydrator::hydrateAllData() #13469

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

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

State: closed
Merged: Yes


This optimization removes the intermediate array allocation during scalar column hydration. Instead of fetching all numeric rows and extracting the first column via array_column, it now calls fetchFirstColumn() directly. In the context of PDO, this aligns with the driver's native behavior (e.g. Doctrine\DBAL\Driver\PDO\Result::fetchFirstColumn()), allowing the hydration layer to skip redundant copying and memory usage.

**Original Pull Request:** https://github.com/doctrine/orm/pull/12095 **State:** closed **Merged:** Yes --- This optimization removes the intermediate array allocation during scalar column hydration. Instead of fetching all numeric rows and extracting the first column via array_column, it now calls fetchFirstColumn() directly. In the context of PDO, this aligns with the driver's native behavior (e.g. [Doctrine\DBAL\Driver\PDO\Result::fetchFirstColumn()](https://github.com/doctrine/dbal/blob/ca0c02766abedaec642f02c308d010b098029b34/src/Driver/PDO/Result.php#L57)), allowing the hydration layer to skip redundant copying and memory usage.
admin added the pull-request label 2026-01-22 16:17:11 +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#13469