-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add getSection at ResourceControllerEvent #109
Comments
Adding a section may be a good starting point, but whole RequestConfiguration makes a lot of sense as well. |
I would say it's best to sends in the whole requestConfiguration - makes it more flexible and it's strongly typed anyway. If someone wants to know other things besides the section, it can also be used. |
@stefandoorn @lchrusciel I find it quite annoying that a lot of resource layer services require the request configuration, even though they often only need 1-3 parameters to do their job. |
@vvasiloi I totally can understand your point. Maybe this configuration should not be a part of an event, but easily available through container? Forced coupling of logic to ResourceController is something that we should totally work on and improve in the future. |
It's kind of already available through the container: |
I still think the initial idea is good, but for people having the problem I fixed this like this here: https://github.com/Setono/SyliusFacebookTrackingPlugin/blob/master/src/EventListener/TagSubscriber.php#L69 |
Describe the proposed solution
Add
setSection
toResourceControllerEvent
and pass section from request configuration:Alternative solution
Add whole
requestConfiguration
to event.Additional context
When we subscribe to (for example)
sylius.product.show
event to embed some tracker html code like Google tag manager - we don't want to embed it at admin area. So we should somehow know whatsection
(shop
,admin
,admin_api
, etc) we're at to skip non-shop
sections.I will provide PR if this idea looks good for core team.
The text was updated successfully, but these errors were encountered: