mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #648] [CLOSED] Add a AddParameters method in the QueryBuilder #8507
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/648
Author: @Taluu
Created: 4/13/2013
Status: ❌ Closed
Base:
master← Head:query-builder-add-parameters📝 Commits (2)
7d702f6Add a AddParameters method in the QueryBuilderc5ee75aAdded another assertion for the addParameters test📊 Changes
2 files changed (+56 additions, -0 deletions)
View changed files
📝
lib/Doctrine/ORM/QueryBuilder.php(+32 -0)📝
tests/Doctrine/Tests/ORM/QueryBuilderTest.php(+24 -0)📄 Description
Hi,
On doctrine 2.2, when we were calling the method
setParametersto set a bunch of parameters on the QueryBuilder, each parameters were added or modified if they were already existing.That is not the case since doctrine 2.3 : each calls to
setParameterswill wipe out the other already setted parameters. I think it is logic, but still is a huge BC break, which is not really mentionned in the UPGRADE file (only the one regarding the use of an ArrayCollection is mentionned).With this PR, I added a
addParameterswhich allows to add several parameters in several calls. Here is a use case :So, as I was saying, until 2.2, you could use
setParametersin the main method (getUserWithSomething) which was calling (or not) the submethodaddSince, which could set parameters before calling thesetParametersmethod. Now, you can't do that anymore : either you need to make several calls tosetParameter:Either, I guess, you need to first retrieve all the parameters and then add them by hand :
So that's why I propose this new method in the QueryBuilder. if I'm wrong anywhere, or need more information please feel free to comment. :)
Cheers.
edit : If I tried to use either a
ArrayCollectionor anarrayin the parameters, it's because I tried to keep in mind the BC breeaks for 2.2 and below branches, and if I am converting theParameterinto a simple array, it is to ease the use forsetParameter.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.