Answer the question
In order to leave comments, you need to log in
Doctrine - how to filter (where) result by ManyToOne field?
Hello. I just can't find an option on how to filter the results of a query built with Query Builder. One of the models has a user_id field
/**
* @ManyToOne(targetEntity="Users")
* @JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
private $user;
$qb->where('mc.user_id = :user');
Answer the question
In order to leave comments, you need to log in
$qb->where('mc.user = :user')
You should operate in DQL/Querybuider only with those fields which are in your object. Otherwise, there's no point in DQL/QueryBuidler, if you need more and how it all fits into the base to know.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question