8000 [Form] error_mapping doesn't work for non-mapped field · Issue #10519 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Form] error_mapping doesn't work for non-mapped field #10519
Closed
@Koc

Description

@Koc

Example code to reproduce:

class User
{
}

class UserType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add(
                'cityTitle',
                'text',
                array(
                    'mapped' => false,
                )
            )
            ->add(
                'city',
                'entity_id',
                array(
                    'mapped' => false, // will work ok when true
                    'class' => 'MetalTerritorialBundle:City',
                )
            );
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(
            array(
                'data_class' => 'Metal\UsersBundle\Entity\User',
                'error_mapping' => array(
                    'city' => 'cityTitle',
                ),
            )
        );
    }
}

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

      0