mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Use fieldNames instead of fieldMappings, if columnPrefix=false #6078
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 @waahhhh on GitHub (Sep 27, 2018).
Originally assigned to: @Ocramius on GitHub.
Intro
Example:
Embeddable :
Entity:
An Query:
My recommendation:
Summary
When using
columnPrefix=falsethe column is namedpriceinstead ofprice_price.So it is not possible to have multiple
pricecolumns.In
\Doctrine\ORM\Persisters\Entity\BasicEntityPersister::getSelectConditionStatementColumnSQL()the Mapping$this->class->fieldMappingsis used, which knows the columnpriceasprice.price.In
$this->class->fieldNamesthe columnpriceis mapped by the indexpriceand the valueprice.price. I would suggest to usefieldNamesin case ofcolumnPrefix=falseinstead.@Ocramius commented on GitHub (Sep 27, 2018):
This is correct and expected.
This is also correct and expected:
$repo->findBy(['price' => new Price()])would be the correct approach if the sub-field is not used, but this is not supported.