Add a AddParameters method in the QueryBuilder#648
Add a AddParameters method in the QueryBuilder#648Taluu wants to merge 2 commits intodoctrine:masterfrom
Conversation
|
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-2400 We use Jira to track the state of pull requests and the versions they got |
|
@guilhermeblanco can you say something here? You refactored the parameter handling. |
|
@Taluu Method @beberlei I'm against bloating the Query API even more to add another alternative way to do something it's already possible to do 2 different ways. If we really want to simplify the Query API, that indeed demands a BC break (removing Closing the ticket as Query API should be simplified, not increased. I'm -1 on this. |
Yup, that's what I thought, and also thought it was logic to do so. But I still think there should be a simpler way to add (or rewrite) parameters, than having to manually having to create the needed
edit : nevermind, I had my answer : all the parameters are wiped out if using the argument in the |
|
@Taluu it calls |
|
@Taluu such method would require subclassing ArrayCollection into a possible ParameterCollection and adding handy method, like |
|
@guilhermeblanco I'm also +1 for a |
|
Yup, I'm also +1 on the BTW I was always wondering why the |
|
@guilhermeblanco |
|
|
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.