[PR #213] [CLOSED] QueryBuilder::getQuery #7870

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

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/213
Author: @armetiz
Created: 12/9/2011
Status: Closed

Base: masterHead: patch-5


📝 Commits (1)

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/QueryBuilder.php (+1 -1)

📄 Description

Hi there,
I'm wondering myself if the QueryBuilder::getQuery is a good method name.
Actually, a getMethodObject makes me think that I can use many times the getMethodObject and work with the same object.
e.g :

$qb->getQuery()->useResultCache (true);
$qb->getQuery()->execute();

In my code, the problem is that getQuery return a new instance of Query each time that I call getQuery.
Furthermore, the getQuery method invoke a createQuery method.

So, maybe the QueryBuiler::getQuery can store a reference to the created Query instance, and if the QueryBuilder::getQuery is call many times without any change return the stored instance.
If the QueryBuilder::getQuery have to generate a new Query, throw an exception or something like that.

Because of a change to QueryBuilder::createQuery is a major change, I don't think that It could be the solution, but it's a reflexion around this.

What do you think about that ?


🔄 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/213 **Author:** [@armetiz](https://github.com/armetiz) **Created:** 12/9/2011 **Status:** ❌ Closed **Base:** `master` ← **Head:** `patch-5` --- ### 📝 Commits (1) - [`934e9bb`](https://github.com/doctrine/orm/commit/934e9bb2e7ca1ae85c30d5d621d2cdf430d4bf95) QueryBuilder::getQuery ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/QueryBuilder.php` (+1 -1) </details> ### 📄 Description Hi there, I'm wondering myself if the QueryBuilder::getQuery is a good method name. Actually, a getMethodObject makes me think that I can use many times the getMethodObject and work with the same object. e.g : ``` php $qb->getQuery()->useResultCache (true); $qb->getQuery()->execute(); ``` In my code, the problem is that getQuery return a new instance of Query each time that I call getQuery. Furthermore, the getQuery method invoke a createQuery method. So, maybe the QueryBuiler::getQuery can store a reference to the created Query instance, and if the QueryBuilder::getQuery is call many times without any change return the stored instance. If the QueryBuilder::getQuery have to generate a new Query, throw an exception or something like that. Because of a change to QueryBuilder::createQuery is a major change, I don't think that It could be the solution, but it's a reflexion around this. What do you think about that ? --- <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:57:18 +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#7870