-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
Milestone
Description
Q | A |
---|---|
Bug report? | yes |
Symfony version | 3.2.1 |
I'm using Symfony3.2 , I get this error when using choice_value in the formType but it works good with symfony3.1
"Error: Call to a member function getSlug() on a non-object" at D:\wamp\www\my_project\src\AppBundle\Form\Bien\BienType.php line 77
use AppBundle\Entity\Ville;
//......
->add('ville', EntityType::class, array(
'class' => 'AppBundle:Ville',
'label' => 'Ville',
'choice_label' => 'nom',
'placeholder' => 'Ville ',
'multiple' => false,
'expanded' => false,
'choice_value' => function ($ville) {
/** @var Ville $ville */
return $ville->getSlug();
},
))
but it works fine with choice_label:
'choice_label' => function ($ville) {
/** @var Ville $ville */
return $ville->getSlug();
},
I have the same code with choice_value in another project with Symfony3.1 and it works good.