-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[*Bundle] Add autowiring aliases for common services #22098
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
<services> | ||
<!-- ResolvedFormTypeFactory --> | ||
<service id="form.resolved_type_factory" class="Symfony\Component\Form\ResolvedFormTypeFactory" /> | ||
<service id="Symfony\Component\Form\ResolvedFormTypeFactoryInterface" alias="form.resolved_type_factory" public="false" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it actually needed ? I never had a need to inject it directly. This service should probably only be used by the form registry and the form factory, not by userland code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dunno, but it's public and has an interface, so does no harm at least |
||
|
||
<!-- FormRegistry --> | ||
<service id="form.registry" class="Symfony\Component\Form\FormRegistry"> | ||
|
@@ -21,12 +22,14 @@ | |
</argument> | ||
<argument type="service" id="form.resolved_type_factory" /> | ||
</service> | ||
<service id="Symfony\Component\Form\FormRegistryInterface" alias="form.registry" public="false" /> | ||
|
||
<!-- FormFactory --> | ||
<service id="form.factory" class="Symfony\Component\Form\FormFactory"> | ||
<argument type="service" id="form.registry" /> | ||
<argument type="service" id="form.resolved_type_factory" /> | ||
</service> | ||
<service id="Symfony\Component\Form\FormFactoryInterface" alias="form.factory" public="false" /> | ||
|
||
<!-- DependencyInjectionExtension --> | ||
<service id="form.extension" class="Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension" public="false"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ | |
<argument type="collection" /> | ||
<argument type="collection" /> | ||
</service> | ||
<service id="Symfony\Component\Serializer\SerializerInterface" alias="serializer" public="false" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also mark |
||
<service id="Symfony\Component\Serializer\NormalizerInterface" alias="serializer" public="false" /> | ||
<service id="Symfony\Component\Serializer\DenormalizerInterface" alias="serializer" public="false" /> | ||
<service id="Symfony\Component\Serializer\EncoderInterface" alias="serializer" public="false" /> | ||
<service id="Symfony\Component\Serializer\DecoderInterface" alias="serializer" public="false" /> | ||
|
||
<service id="serializer.property_accessor" alias="property_accessor" public="false" /> | ||
|
||
|
@@ -27,6 +32,7 @@ | |
<!-- Run after all custom normalizers --> | ||
<tag name="serializer.normalizer" priority="-1000" /> | ||
</service> | ||
<service id="Symfony\Component\Serializer\Normalizer\ObjectNormalizer" alias="serializer.normalizer.object" public="false" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it necessary ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure that there is a good use case to inject this normalizer using autowiring. I would not recommend to do it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably a better idea to alias |
||
|
||
<service id="serializer.denormalizer.array" class="Symfony\Component\Serializer\Normalizer\ArrayDenormalizer" public="false"> | ||
<!-- Run before the object normalizer --> | ||
|
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.
This change violates the Liskov substitution principle,
getFlashBag()
is not part of this interface.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 PR description for why we need to do this.
The addFlash() method now throws a LogicException when needed.