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

further improvements based on comments to #22 #23

Merged
merged 7 commits into from
Sep 14, 2015

Conversation

craue
Copy link
Owner

@craue craue commented Sep 9, 2015

This improves the code based on comments to #22.

? $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)
Copy link
Contributor

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

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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

Copy link
Owner Author

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.

Copy link
Contributor

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.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

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.

Copy link
Owner Author

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.

craue added a commit that referenced this pull request Sep 14, 2015
@craue craue merged commit 99aa78f into master Sep 14, 2015
@craue craue deleted the avoid-deprecation-notices-reloaded branch September 14, 2015 10:12
craue added a commit that referenced this pull request Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants