You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When using a parameter as the class given to a service Definition, the FormPass will trigger a deprecation warning or throw an Exception for not being able to ensure method getExtendedTypes exists.
Now, when running your app, you'lle get this deprecation warning:
Not implementing the static getExtendedTypes() method in %foo_form_service_class% when implementing the Symfony\Component\Form\FormTypeExtensionInterface is deprecated since Symfony 4.2. The method will be added to the interface in 5.0.
If you set up the service without a backwards-compatible definition such as:
(1/1) InvalidArgumentException "form.type_extension" tagged services have to implement the static getExtendedTypes() method. The class for service "foo_form_service" does not implement it.
Possible Solution
Other than trying to resolve the class as a parameter in Symfony\Component\Form\DependencyInjection\FormPass, it could be possible to deprecate using parameters to provide the class of a service altogether.
Additional context
This is all happening in Symfony\Component\Form\DependencyInjection\FormPass::processFormTypeExtensions().
This PR was merged into the 4.2 branch.
Discussion
----------
[Form] resolve class name parameters
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31052
| License | MIT
| Doc PR |
Commits
-------
5235be4 resolve class name parameters
Symfony version(s) affected: 4.2+
Description
When using a parameter as the class given to a service Definition, the FormPass will trigger a deprecation warning or throw an Exception for not being able to ensure method
getExtendedTypes
exists.How to reproduce
Create a form type extension:
Set up the configuration:
Now, when running your app, you'lle get this deprecation warning:
If you set up the service without a backwards-compatible definition such as:
Then an exception will be thrown:
Possible Solution
Other than trying to resolve the class as a parameter in
Symfony\Component\Form\DependencyInjection\FormPass
, it could be possible to deprecate using parameters to provide the class of a service altogether.Additional context
This is all happening in
Symfony\Component\Form\DependencyInjection\FormPass::processFormTypeExtensions()
.I've noticed this while using LexikFormFilterBundle.
The text was updated successfully, but these errors were encountered: