-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Declare a separate ImagesUploadListener service #9310
Declare a separate ImagesUploadListener service #9310
Conversation
class: Sylius\Bundle\CoreBundle\EventListener\ImagesUploadListener | ||
decorates: sylius.listener.image_upload | ||
arguments: ['@sylius.image_uploader'] |
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.
Don't we need @app.listener.image_upload.inner
here now?
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.
We're not using it, because we're basically "abusing" service decoration. 😛
class: Sylius\Bundle\CoreBundle\EventListener\ImagesUploadListener | ||
decorates: sylius.listener.image_upload |
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.
Okay, I guess we should use parent: sylius.listener.image_upload
here, then we can remove arguments
(as they are inherited) and just include tags (as we're not really decorating the service).
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.
tags
are not inherited from the parent service. Or do you mean we should use decorates
together with parent
?
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 don't think it'll work: symfony/symfony#14543
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.
IIRC tags
aren't inherited from the decorated service as well (for this PR, these product & taxon tags are still assigned to @app.listener.image_upload.inner
and shipping method ones will be assigned to @app.listener.image_upload
).
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.
Tags are copied over when decorating. See the referenced PR in the description. :)
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.
Anyway, since we use decoration, anywhere sylius.listener.images_upload
is used, it'll basically be replaced by app.listener.images_upload
. The original service will not be used anymore. In fact, it will be automatically removed from the container if it's a private service and unused.
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.
Oh, and I just noticed the original typo in the service name (or it was changed). The free extra benefit we get by using decoration is that it'll fail if the service being decorated is not found. 😃
566e9ec
to
9b75032
Compare
I've just tried it, and using |
@pamil Any decision on this? |
Don't override sylius.listener.images_upload
9b75032
to
d24b2d4
Compare
@pamil This should be good now. 😄 |
Thank you, Teoh! 🥇 |
Don't override
sylius.listener.images_upload
, so that we don't have to duplicate tags that might change at anytime.