Reputation: 1
$qb->select('c')
->innerJoin('c.phones', 'p', 'WITH', 'p.phone = :phone')
->where('c.username = :username')
->setParameter('phone', $phone)
->setParameter('username', $username);
why do we use c.phones when we can just use innerJoin('phones', 'p', 'WITH', 'p.phone = :phone')?
Upvotes: -1
Views: 29
Reputation: 1
Answering my own question: So in doctrine we need to think in terms of entities, not worry about tables. So if phones is a reference in that entity, then you just join the table by using c.phones, doctrine will then do the magic of joining tables.
Upvotes: 0
Reputation: 2966
phones
on its own may be ambiguous if more than one entity defines phones
property. Using c.
gives ORM exact information what user is expecting to happen.
Upvotes: 0