-
Notifications
You must be signed in to change notification settings - Fork 35
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
further improvements based on comments to #22 #23
Conversation
? $this->createForm(new LegacyModifySettingsForm(), $formData) | ||
: $this->get('form.factory')->createNamed('craue_config_modifySettings', 'Craue\ConfigBundle\Form\ModifySettingsForm', $formData); | ||
$form = method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix') | ||
? $this->get('form.factory')->createNamed('craue_config_modifySettings', 'Craue\ConfigBundle\Form\ModifySettingsForm', $formData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you define getBlockPrefix
properly (and you should, otherwise you break BC for form theming), you would not need to use createNamed
, and would be able to use the shortcut here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #22 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it uses the block prefix as the default name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I might've hit a bug here, but tests fail if I change this line to ? $this->createForm('Craue\ConfigBundle\Form\ModifySettingsForm', $formData)
while getBlockPrefix
returns craue_config_modifySettings
as well since modify_settings_form
is actually used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, indeed. FormFactory::create
does not deal with customized block prefixes properly. It always turns the FQCN to a block prefix (similar to the default implementation of the method).
This should be reported to Symfony as a bug in the 2.8 implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in symfony/symfony#15760.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging the PR now, will change this line once the mentioned issue is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit f1cc739, now that the issue is fixed by symfony/symfony#16758.
further improvements based on comments to #22
This improves the code based on comments to #22.