-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
Description
I have such a code
$res = $this->getVehicleRepo()->getQueryBuilder(
Spec::andX(
Spec::select('model'),
new IsNotSold(),
new JoinModelModifier(),
new ModelsBelongToMaker($makerId)
)
);
I'm going to select fields from the Model table, which is joined by new JoinModelModifier(), while all the selections are performed for the root alias, which comes from the ->getVehicleRepo, i.e. the Vehicle table.
Can't understand how to select such a data, except for doing two separate queries on both repos.
By the way with the classic doctrine I can achieve the desirable with
$res = $this->getNotSoldVehicleQueryBuilder()
->select('(v.model)')
->addSelect('m.name')
->addSelect('m.id')
->join('v.model', 'm')
->join('m.maker', 'mk')
->andWhere('mk.id = :maker_id')
->setParameter('maker_id', $makerId)
->groupBy('v.model');