[PR #151] [MERGED] DDC-1385 #7779

Open
opened 2026-01-22 15:56:47 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/151
Author: @beberlei
Created: 10/16/2011
Status: Merged
Merged: 10/31/2011
Merged by: @beberlei

Base: masterHead: DDC-1385


📝 Commits (4)

  • cb0e5db DDC-1385 - Fixed Mixed result hydration using INDEX BY to work on the top-level indexes, not some weird result. This is a BC break to those that actually use this crazy logic, sorry for that :-)
  • 2730f64 DDC-1385 - Refactor ObjectHydrator
  • ee924ff DDC-1385 - Fix scalar handling for array hydrator
  • 8466060 DDC-1385 - Add INDEX BY scalar variables on the top-level

📊 Changes

6 files changed (+233 additions, -67 deletions)

View changed files

📝 lib/Doctrine/ORM/Internal/Hydration/ArrayHydrator.php (+26 -20)
📝 lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php (+27 -22)
📝 lib/Doctrine/ORM/Query/ResultSetMapping.php (+35 -1)
📝 lib/Doctrine/ORM/Query/SqlWalker.php (+20 -5)
📝 tests/Doctrine/Tests/ORM/Hydration/ArrayHydratorTest.php (+47 -8)
📝 tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php (+78 -11)

📄 Description

This branch does multiple things:

  1. Fix how INDEX BY works with mixed results. The index is now on the top level, not inside the mixed result.

  2. Add support for INDEX BY in scalar only queries.

    SELECT u.id, u.name FROM User u INDEX BY u.id
    

The following BC Breaks had to be made:

  1. The hydration format changed when using INDEX BY with either mixed or scalar only results.
  2. ResultSetMapping::$indexByMap is now $dqlAlias => $columnName, not $dqlAlias => $fieldName anymore.

Todos:

  1. Since Hydration uses 'scalars' internally, we should prevent that identification variable name from being used.
  2. Array Hydration scalar only is missing.
  3. Unit-tests for RSM changes, aswell as some more error conditions (Exceptions).
  4. Scalar only array hydration for nested levels?

Please code review.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/151 **Author:** [@beberlei](https://github.com/beberlei) **Created:** 10/16/2011 **Status:** ✅ Merged **Merged:** 10/31/2011 **Merged by:** [@beberlei](https://github.com/beberlei) **Base:** `master` ← **Head:** `DDC-1385` --- ### 📝 Commits (4) - [`cb0e5db`](https://github.com/doctrine/orm/commit/cb0e5dbff32711093e4f7055ab3d9daaf036d401) DDC-1385 - Fixed Mixed result hydration using INDEX BY to work on the top-level indexes, not some weird result. This is a BC break to those that actually use this crazy logic, sorry for that :-) - [`2730f64`](https://github.com/doctrine/orm/commit/2730f64d90cb0ec97fe35cea950d530722bbafbc) DDC-1385 - Refactor ObjectHydrator - [`ee924ff`](https://github.com/doctrine/orm/commit/ee924ffaba4dc8b666dc2b6070ce1b4b5f7f1308) DDC-1385 - Fix scalar handling for array hydrator - [`8466060`](https://github.com/doctrine/orm/commit/8466060797f0f9c85dd8f9d6b36906c4cbf2e8f7) DDC-1385 - Add INDEX BY scalar variables on the top-level ### 📊 Changes **6 files changed** (+233 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Internal/Hydration/ArrayHydrator.php` (+26 -20) 📝 `lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php` (+27 -22) 📝 `lib/Doctrine/ORM/Query/ResultSetMapping.php` (+35 -1) 📝 `lib/Doctrine/ORM/Query/SqlWalker.php` (+20 -5) 📝 `tests/Doctrine/Tests/ORM/Hydration/ArrayHydratorTest.php` (+47 -8) 📝 `tests/Doctrine/Tests/ORM/Hydration/ObjectHydratorTest.php` (+78 -11) </details> ### 📄 Description This branch does multiple things: 1. Fix how INDEX BY works with mixed results. The index is now on the top level, not inside the mixed result. 2. Add support for INDEX BY in scalar only queries. ``` SELECT u.id, u.name FROM User u INDEX BY u.id ``` The following BC Breaks had to be made: 1. The hydration format changed when using INDEX BY with either mixed or scalar only results. 2. ResultSetMapping::$indexByMap is now $dqlAlias => $columnName, not $dqlAlias => $fieldName anymore. Todos: 1. Since Hydration uses 'scalars' internally, we should prevent that identification variable name from being used. 2. Array Hydration scalar only is missing. 3. Unit-tests for RSM changes, aswell as some more error conditions (Exceptions). 4. Scalar only array hydration for nested levels? Please code review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:56:47 +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#7779