mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
QueryBuilder::getQuery does not clone parameters, is this intended or a bug? #6221
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?
Originally created by @datadestroyd on GitHub (Apr 15, 2019).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Summary
QueryBuilder::getQuerydoes not deep clone the parameters. I am unsure whether this is intended behavior or a bug. The docs don't mention it. However, I find it very counterintuitive.Current behavior
When calling
getQueryon aQueryBuilder, the parameters are copied into theQueryinstance. However, subsequently modifying parameters on the builder, e.g. to create another similar query, also modify the parameters in the previousQueryinstance.How to reproduce
Expected behavior
$queryA->getParameter('param')->getValue()should return'foo', not'bar'.