mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Collections/ExpressionBuilder::contains generate CONTAINS instead of LIKE in MySQL #5874
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 @holantomas on GitHub (Feb 6, 2018).
Hi,
I found that if I try to filter over PersistentCollection using contains(there's no
LIKElike in query builder) it throws SQL Error cause used key word CONTAINS instead of LIKE in WHERE conditions.https://github.com/doctrine/doctrine2/pull/7042
@Ocramius commented on GitHub (Feb 6, 2018):
Absolute ref to linked line:
6a205be3be/lib/Doctrine/Common/Collections/ExpressionBuilder.php (L145)@holantomas commented on GitHub (Feb 6, 2018):
@Ocramius I don't know how deal with this link 😆. I found that line, that's why I thought that's doctrine\collections bug.
@Ocramius commented on GitHub (Feb 6, 2018):
@holantomas #7042 seems to pass - so I guess you didn't yet reproduce it in isolation: is that the problem?
@holantomas commented on GitHub (Feb 6, 2018):
Actually that's right. If I run same test code in my enviroment, it crash. I respond on PR topic.
https://github.com/doctrine/doctrine2/pull/7042#issuecomment-363384191
@holantomas commented on GitHub (Feb 6, 2018):
Ok, now it throwing right exception. I used ManyToOne before. Update test case to use ManyToMany collection and clear entity manager to force loading from DB.
https://travis-ci.org/doctrine/doctrine2/jobs/337967124#L1855
@holantomas commented on GitHub (Feb 7, 2018):
@Ocramius @mikeSimonson Thanks to @vaniocz there is problem in ManyToManyPersister where operator is directly written instead of translate. So there should not work any operator like MEMBER_OF, CONTAINS, ...
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/Collection/ManyToManyPersister.php#L283