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

[Form][2.8] Type "entity" not setting selected data when choice_value is a string attribute #17271

Copy link
Copy link
Closed
@Rasanga

Description

@Rasanga
Issue body actions

I have the following code:

$builder->add('category', 'entity', [
                'required'      => false,
                'class'         => 'Ras\Bundle\DomainBundle\Entity\Category',
                'choice_value'  => 'name',
                'choice_label'  => 'label'
            ]);

When I select a category it does not give me the selected category entity, but when I changed choice_value to be id it worked fine. There seem to be an issue when the choice_value is a string attribute

NOTE:
Ras\Bundle\DomainBundle\Entity\Category entity has following attributes: id, name, label

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.