Added addParameters() to Query and QueryBuilder#512
Added addParameters() to Query and QueryBuilder#512jaspernbrouwer wants to merge 3 commits intodoctrine:masterfrom jaspernbrouwer:master
Conversation
This method behaves like setParameters() before version 2.3
|
Hello, thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link: |
lib/Doctrine/ORM/AbstractQuery.php
Outdated
There was a problem hiding this comment.
I fixed this.
lib/Doctrine/ORM/AbstractQuery.php
Outdated
There was a problem hiding this comment.
please remove the spaces inside braces for function calls
Also removed require_once from test.
|
I don't feel strong need to have such an API. |
|
Hi Guilherme, I agree that such a method makes less sense in I guess it's just a convenience method, like IMHO The main reason for adding the method was, like I said, upgrading to Doctrine 2.3. I've already upgraded all my projects to Doctrine 2.3, so the method is less useful for me now. But it took me a full day to refactor my repositories, because there is no safe way to automate the process. A simple search-and-replace I'm content with your decision. |
This method behaves like
setParameters()before version 2.3:It will add new parameters to the collection, and override any existing positions/names.
It can take a
Doctrine\Common\Collections\ArrayCollectionwithDoctrine\ORM\Query\Parameterobjects, as well as a plainarraywith key/value pairs, as argument.This will greatly ease the upgrade to Doctrine 2.3, because you only need to perform a project-wide replace of
setParameterswithaddParameters, in stead of going into your code and determine if calls tosetParametersare ok or need refactoring.I've also added unit-tests to maintain integrity.