IN the AcmePizza BUndle this is working fine
->add(\'pizza\', \'entity\', array(
\'class\' => \'Acme\\PizzaBundle\\Entity\\Pizza\',
In Symfony 2.7 i solved this by doing the following in the UserTaskType:
add('the_name', 'entity', array(
'class' => 'acme\myBundle\Entity\UserTask',
'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('u')
->where('u.id > :id')
->setParameter('id', '1')
->orderBy('u.username', 'ASC');
},
));
}
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'acme\myBundle\Entity\UserTask',
));
}
}