$builder
->add(
'maker',
'entity',
array(
'class' => 'CrbrBundle:CrbrItemMaker',
'property' => 'name',
'required' => false,
'data' => $options['maker'],
'empty_value' => '-- Все --',
'query_builder' => function (EntityRepository $er) use ($options) {
return $er->createQueryBuilder('x')
->innerJoin('x.item', 'i')
->innerJoin('i.category', 'c')
->innerJoin('c.parentCategory', 'h')
->andWhere('h.categoryGroup = :groupCategory')
->setParameter(
'groupCategory',
$options['groupCategory']
);
}
,
)
)
'query_builder' => function (EntityRepository $er) use ($options) {
if ($options['groupCategory'] == 3) {
return $er->createQueryBuilder('x');
}
return $er->createQueryBuilder('x')
->innerJoin('x.item', 'i')
->innerJoin('i.category', 'c')
->innerJoin('c.parentCategory', 'h')
->andWhere('h.categoryGroup = :groupCategory')
->setParameter(
'groupCategory',
$options['groupCategory']
);
}