Let's suppose I have two documents
Users and Purchases. All the purchase have a reference to a User, and Users have a field gender in it.
I want to select the products bought by male clients. So I have the gender and I want to iterate thought the purchases and define their "gender".
Something like that
public function findByGender()
{
$query =
$this->createQueryBuilder()
->field(""Purchase->User->gender"")->equals('male')
->getQuery()
;
}
But of course the code between ""... "" does not work. I would like to know if it is possible, and if is, how could I do it?