Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[2.7] Expanded Entity Form Element with negative id values #15273

Copy link
Copy link
Closed
@Waigie

Description

@Waigie
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.