Я хотел бы в своем поле выбрать все объекты, из которых их etat = 1
для этого я определил в своем классе репозитория метод, код которого следующий:
/**
* @return MarcheDAO[] Returns an array of MarcheDAO objects
*/
public function findMarcheEnCours($etat)
{
return $this->createQueryBuilder('d')
->select('d.nomMarche as marche')
->andWhere('d.etat = :etat')
->setParameter('etat', $etat)
->getQuery()
->getResult();
}
в моем FormType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('marche', EntityType::class, [
'class' => MarcheDAO::class,
'query_builder' => function(MarcheDAORepository $repo) {
return $repo->findMarcheEnCours(1);
},
'choice_label' => 'MarcheDAO.nomMarche'
])
И это моя ошибка,
Argument 1 passed to App\Form\SoumissionType::App\Form\{closure}() must be an instance of App\Form\MarcheDAORepository, instance of App\Repository\MarcheDAORepository given, called in C:\wamp\www\AppelsOffres\vendor\symfony\doctrine-bridge\Form\Type\EntityType.php on line 32
'query_builder' => function(MarcheDAORepository $repo) {..
помоги мне, пожалуйста !!