Symfony 3 Abstracttype pour une entity
Bonjour à tous,
Voila je cherche a remplir une liste déroulante avec les données d'une bdd...
Voici mon abstractType :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| class annonceType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('categorie', EntityType::class, array(
'class' => 'XXXXBundle:categories',
'query_builder' => function(categoriesRepository $er){
return $er->createQueryBuilder('M')
->select('DISTINCT M.categorie');
}));
} |
Mais je tombe sur cette erreur
Warning: spl_object_hash() expects parameter 1 to be object, string given in vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php at line 1239
J'ai essayé avec un findAll(), mais la il me reproche un Array....
Quelqu'un pourrait m'aider?
Merci