Closed
Description
Since 2.7 using expanded Entity Form Elements, which allow multiple selections (checkboxes) with data having negativ IDs is not possible anymore, because the new naming conventions prohibit names starting with a '-'
Example
Database Table
ID | Name |
---|---|
-1 | Foo |
1 | Bar |
2 | Baz |
Code
class ExampleForm extends Form
{
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add(
'element',
'entity',
array(
'class' => 'AppBundle:ExampleEntity',
'label' => 'Expanded Entity',
'expanded' => true,
'multiple' => true,
)
);
}
}
Creating this form with the Symfony Form Builder will generate the following Error:
The name "-1" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").
Prior to Symfony 2.7.0 everything works fine, including 2.6.10.