Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FORM] invalid ExecutionContext #37185

Closed
versh23 opened this issue Jun 10, 2020 · 3 comments
Closed

[FORM] invalid ExecutionContext #37185

versh23 opened this issue Jun 10, 2020 · 3 comments

Comments

@versh23
Copy link

versh23 commented Jun 10, 2020

Symfony version(s) affected: 5.0.9\5.1.0

Description

After this PR #36865 we have a BUG
there are invalid ExecutionContext.getObject when using subforms

Example

class LoginType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $callback = function ($object, ExecutionContextInterface $context, $payload) {
            dump($context->getObject()->getName(), $context->getRoot()->getName());
        };

        $builder
            ->add('username', TextType::class, [
                'constraints' => new NotBlank(),
            ])
            ->add('form2', LoginType2::class, [
                'constraints' => [
                    new Callback($callback)
                ]
            ]);
        ;
    }
}

dump

LoginType.php on line 19:
"login"
LoginType.php on line 19:
"login"

If revert changed
dump

LoginType.php on line 19:
"form2"
LoginType.php on line 19:
"login"

@xabbuh

@xabbuh
Copy link
Member

xabbuh commented Jun 10, 2020

Same as #37072 and thus will be fixed by #37103?

@xabbuh xabbuh added the Form label Jun 10, 2020
@versh23
Copy link
Author

versh23 commented Jun 10, 2020

yes. its working

@xabbuh
Copy link
Member

xabbuh commented Jun 10, 2020

Thank you for the confirmation. Let's close here then as we already have an open issue for it.

@xabbuh xabbuh closed this as completed Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants