[PR #841] [CLOSED] Enable saving native queries using ResultSetMappingBuilder. #8782

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

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/841
Author: @TheFrozenFire
Created: 11/7/2013
Status: Closed

Base: masterHead: feature/named-native-query-resultsetmappingbuilder-interpolation


📝 Commits (1)

  • 1c25f52 Enable saving native queries using ResultSetMappingBuilder.

📊 Changes

3 files changed (+20 additions, -3 deletions)

View changed files

📝 lib/Doctrine/ORM/Configuration.php (+2 -2)
📝 lib/Doctrine/ORM/EntityManager.php (+6 -1)
📝 tests/Doctrine/Tests/ORM/EntityManagerTest.php (+12 -0)

📄 Description

At present, a useful feature of ResultSetMappingBuilder, which creates the SELECT clause relevant to the built result set mapping, is unusable with named native queries.

This feature adds two additional, optional parameters to named native queries which stores an arbitrary string placeholder and an array of table aliases with the query.

Upon creation of the named native query, if the ResultSetMapping is a ResultSetMappingBuilder, and the placeholder is specified, the arbitrary string specified as the placeholder will be replaced with the output of ResultSetMappingBuilder::generateSelectClause(), passed the table aliases.

This allows native queries to be bootstrapped into an application as named queries, while also allowing the select clause to be automatically updated in the query as the metadata for the mapped entities changes.

Because native queries are not parsed in any way, a string placeholder is required to be able to interpolate the select clause into the query.


🔄 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/841 **Author:** [@TheFrozenFire](https://github.com/TheFrozenFire) **Created:** 11/7/2013 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/named-native-query-resultsetmappingbuilder-interpolation` --- ### 📝 Commits (1) - [`1c25f52`](https://github.com/doctrine/orm/commit/1c25f525eb59734531458a9fb2109c4cfd647850) Enable saving native queries using ResultSetMappingBuilder. ### 📊 Changes **3 files changed** (+20 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/Configuration.php` (+2 -2) 📝 `lib/Doctrine/ORM/EntityManager.php` (+6 -1) 📝 `tests/Doctrine/Tests/ORM/EntityManagerTest.php` (+12 -0) </details> ### 📄 Description At present, a useful feature of ResultSetMappingBuilder, which creates the SELECT clause relevant to the built result set mapping, is unusable with named native queries. This feature adds two additional, optional parameters to named native queries which stores an arbitrary string placeholder and an array of table aliases with the query. Upon creation of the named native query, if the ResultSetMapping is a ResultSetMappingBuilder, and the placeholder is specified, the arbitrary string specified as the placeholder will be replaced with the output of ResultSetMappingBuilder::generateSelectClause(), passed the table aliases. This allows native queries to be bootstrapped into an application as named queries, while also allowing the select clause to be automatically updated in the query as the metadata for the mapped entities changes. Because native queries are not parsed in any way, a string placeholder is required to be able to interpolate the select clause into the query. --- <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 16:01:41 +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#8782