mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Query Builder SingleValuedAssociationField expected #5825
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 @shubaivan on GitHub (Dec 28, 2017).
I have native sql query with left join when have on with or condition, how to represent it in query builder ?
and I need represent it in query builder but in
Userentity I have ManyToMany relation, without separate table and when I try left join with condition I have errorSingleValuedAssociationField expected.User entity
CostObject entity
and my query builder without condition
this is
$query->getSQL()and I need change it like in nativbe query but when I add condition to left join I get error
query with condition
and error
I try add
IDENTITYlike reсomended me in answerbut still have error
@Majkl578 commented on GitHub (Dec 28, 2017):
Since
com.costObjectsseems to be to-many collection, you should useMEMBER OF. This should work:@shubaivan commented on GitHub (Dec 28, 2017):
@Majkl578 how should I apply this approach to my query ? How should look
orXin myleftJoin?@Majkl578 commented on GitHub (Dec 28, 2017):
It's orX(), so:
@shubaivan commented on GitHub (Dec 28, 2017):
@Majkl578
I debuged it and got sql, this looks
exactly:
do you yhink this is equals to ?
@shubaivan commented on GitHub (Dec 29, 2017):
@Majkl578
Because
WITHthis is additional condition. I said about changeONcondition forleftJointhis is different caseNow sql look like
I want change this relation
users u3_ ON u3_.id = c4_.user_idby
@shubaivan commented on GitHub (Dec 29, 2017):
@Majkl578
But when I changed
WITHtoONI have error
[Syntax Error] line 0, col 112: Error: Expected end of string, got 'ON'