phpcr-odm icon indicating copy to clipboard operation
phpcr-odm copied to clipboard

[BUG?] QueryBuilder::setParameter does not exist, so it's not possible to add them during query building

Open esserj opened this issue 6 years ago • 1 comments

Im going through the documentation of the query builder to find how I must deal with assigning parameters during the query build process.

this is what I come across: https://www.doctrine-project.org/projects/doctrine-phpcr-odm/en/latest/reference/query-builder-reference.html#gt-parameter

setParameter however is not implemented in the QueryBuilder. Was this removed for some reason?

Having such functionality imo is crucial as once you request the query to assign parameters that should apply you can no longer continue building. This would mean that any abstractions you implement for building would have to somehow track all parameters themselves and then assign it to the query, which makes me believe thats the querybuilders job?

On first glance it would also be fairly easy to implement, just assign them during Converter::getQuery() e.g. ConverterPhpcr:getQuery just after creation of the query.

This would not break BC i think, although it could be that some would have extended and implemented get/set parameters for their custom converter ...

any thoughts?

esserj avatar Dec 04 '18 10:12 esserj

sorry that this issue went under. i now looked at it, and indeed it looks a lot like we did not finish adapting the query builder from the ORM. looking at the ORM query builder, it does as you propose (except its all in line and does not use a separate Converter).

i agree with you, the parameter methods to the phpcr query builder and making the converter apply them to the query would be a good improvement, and would not be a BC break. do you want to do a pull request for this?

dbu avatar Jan 07 '19 08:01 dbu