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

AbstractController allow render template with FormInterface #311

Open
laurentmuller opened this issue Mar 14, 2023 · 1 comment
Open

AbstractController allow render template with FormInterface #311

laurentmuller opened this issue Mar 14, 2023 · 1 comment

Comments

@laurentmuller
Copy link

With Symfony 6.2, we can render a template with the following code:

$form = $this->createForm(MyType::class, $data);
return $this->render('my_template.html.twig', [
    'form' => $form,
]);

But psalm complain about this.

Symfony: Create a form view for passing to template

The error comes from the following function:

protected function renderView(string $view, array $parameters = []): string

When used, this function check if one of the given parameters is an instance of FormInterface and if match call the function FormInterface::createView().

@zmitic
Copy link
Contributor

zmitic commented Mar 14, 2023

That's weird. I will have some time on Friday to check this out, I don't see why it would happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants