Reputation: 1
I search, I search but I don't find...
I've got an entity Agent and an entity Gender, in Entity/Agent.php :
/**
* @ORM\ManyToOne(targetEntity="AcNice\ASPBundle\Entity\Gender")
* @ORM\JoinColumn(nullable=true)
*/
private $gender;
Gender can be null. In Form/AgentType.php, I've got :
$builder
->add('gender', 'entity', array(
"class" => "AcNiceASPBundle:Gender",
"property" => "name",
'empty_value' => "Choose your gender",
//"empty_data" => null,
'required' => false,
"expanded" => false))
I've read the doc http://symfony.com/doc/current/reference/forms/types/entity.html, I see if I change "expanded" to true, I've got my "Choose your gender" as checkbox, but I really want a select (for entities nullable with much more choices).
Does someone have a clue ? Pleaaaaase ;-) Thanks.
Upvotes: 0
Views: 458
Reputation: 9246
If you are using version >= Symfony 2.6, you should use placeholder
option instead of empty_value
.
Upvotes: 0