Skip to content

Error in The Form Component #7242

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

Closed
topwebstudio opened this issue Dec 11, 2016 · 6 comments
Closed

Error in The Form Component #7242

topwebstudio opened this issue Dec 11, 2016 · 6 comments
Labels
actionable Clear and specific issues ready for anyone to take them. bug Form hasPR A Pull Request has already been submitted for this issue.
Milestone

Comments

@topwebstudio
Copy link

https://symfony.com/doc/master/components/form.html

$twig->addExtension(
    new FormExtension(new TwigRenderer($formEngine, $csrfManager))
);

This line throws an error.

Uncaught exception 'InvalidArgumentException' with message 'Passing any arguments the constructor of Symfony\Bridge\Twig\Extension\FormExtension is reserved for internal use.'

@xabbuh xabbuh added actionable Clear and specific issues ready for anyone to take them. bug Form labels Dec 12, 2016
@xabbuh xabbuh added this to the 3.2 milestone Dec 12, 2016
@xabbuh
Copy link
Member

xabbuh commented Dec 12, 2016

We indeed need to update the example. Thank you for reporting it @topwebstudio!

However, I wonder why you get the exception and do not see a deprecation being triggered here: https://github.com/symfony/symfony/blob/3.2/src/Symfony/Bridge/Twig/Extension/FormExtension.php#L35

@topwebstudio
Copy link
Author

I followed the guide for the Form component outside Symfony scope (as a standalone).

fabpot added a commit to symfony/symfony that referenced this issue Dec 13, 2016
This PR was merged into the 3.2 branch.

Discussion
----------

[TwigBridge] fix constructor args check

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony-docs#7242
| License       | MIT
| Doc PR        |

Commits
-------

fa82588 [TwigBridge] fix constructor args check
@xabbuh
Copy link
Member

xabbuh commented Dec 13, 2016

@topwebstudio Indeed, I was able to reproduce your initial issue (see the related PR symfony/symfony#20882 which will lead to the expected deprecation instead of the exception).

Nonetheless, we still need to update the documentation. So thanks again for reporting the issue! :)

@topwebstudio
Copy link
Author

I don't know if this is related to Form Component documentation errors above, but when following the official documentation I'm running into new error:

Fatal error: Uncaught exception 'Twig_Error_Runtime' with message 'Unable to load the "Symfony\Bridge\Twig\Form\TwigRenderer" runtime.'

I've made pretty minimalistic example to display this error:
https://github.com/topwebstudio/symfonyform

@xabbuh
Copy link
Member

xabbuh commented Dec 21, 2016

@topwebstudio Can you report this as a bug in the code repository?

@topwebstudio
Copy link
Author

Here is the bug report link

@xabbuh xabbuh added the hasPR A Pull Request has already been submitted for this issue. label Dec 27, 2016
xabbuh added a commit that referenced this issue Jan 10, 2017
This PR was merged into the 3.2 branch.

Discussion
----------

[Form] update FormExtension registration

This fixes #7242.

Commits
-------

ef5b740 [Form] update FormExtension registration
@xabbuh xabbuh closed this as completed Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. bug Form hasPR A Pull Request has already been submitted for this issue.
Projects
None yet
Development

No branches or pull requests

3 participants