New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversion of object query parameters to their identifiers is inconsistent #6209
Comments
I think we should modify |
you mean making |
Btw, this would require changing the interface in doctrine/common too, because this is the documented behavior: https://github.com/doctrine/common/blob/v2.7.1/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php#L54 so I'd rather not change it now |
@stof I can find bugs for basically every usage of About BC breaks, it would need a lookup (on github) of who uses that method, and for which purposes. |
@stof yeah, the interface change would indeed be a breakage, nice spotting :-\ |
I think I just encountered this bug in the wild, using an Entity as parameter in a where condition in DQL without specifying the specific property to use (in this case ID). Worked fine in dev mode, broke after cache warmup in production. |
The detection of whether the object is an entity uses
$this->_em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))
. ButhasMetadataFor
checks whether the factory has loaded metadata for the class. So the behavior depends on what happened previously in the request (and can change between a dev environment and the prod as the prod is more likely to use a cache for the DQL parsing logic, which is one of the place which could trigger the loading of metadata when being executed).I suggest switching to using
! isTransient()
instead (potentially keeping the check for loaded metadata first for performance reasons asisTransient
does not check the loaded metadata to short-circuit drivers).what do you think about it ?
The text was updated successfully, but these errors were encountered: