doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.86k stars 2.5k forks source link

support array in QueryBuilder::setParameters? #11491

Closed dmaicher closed 1 week ago

dmaicher commented 2 weeks ago

Feature Request

While looking into upgrading our largest app to ORM 3 (now unblocked since https://github.com/doctrine-extensions/DoctrineExtensions/issues/2808#issuecomment-2157297748) I stumbled across the breaking change for QueryBuilder::setParameters that now only accepts ArrayCollection<int, Parameter> and no array anymore:

https://github.com/doctrine/orm/blob/9d4f54b9a476f13479c3845350b12c466873fc42/src/QueryBuilder.php#L474

However I noticed that AbstractQuery still accepts array as before:

https://github.com/doctrine/orm/blob/9d4f54b9a476f13479c3845350b12c466873fc42/src/AbstractQuery.php#L303

So I was wondering if there is a reason that those 2 are inconsistent and if we maybe could also allow array again on QueryBuilder::setParameters?

Otherwise I guess I would have to update the 100+ places to use ArrayCollection + Parameter instances or look into writing a rector rule for it :see_no_evil:

Q A
New Feature yes
RFC yes
BC Break no

Summary

Allow array again on QueryBuilder::setParameters to ease upgrade from ORM 2?

dmaicher commented 2 weeks ago

I just now found https://github.com/doctrine/orm/pull/11292#issuecomment-1971045461