I have a one to many schema: Desk has many Bills. Is it possible to fetch all Desk records with some Bill records.
I am trying to do this:
//DeskTable.class.php
public function getDesks()
{
$q = $this->createQuery('d')
->leftJoin('d.Bills b')
->where('b.is_open = ?', true);
return $q->execute();
}
But I get a list of Desks that have open Bills, whereas I need all Desks. Is this possible?
I am totally not a sql kind of kid, so please bear with me.
Use Doctrine's WITH
keyword (docs here):
$q = $this->createQuery('d')
->leftJoin('d.Bills b WITH b.is_open = ?', true)
return $q->execute();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With