-
Notifications
You must be signed in to change notification settings - Fork 49
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
Create action and filter context factories #338
Create action and filter context factories #338
Conversation
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'm just thinking out load, it's not a call to action.)
It's a bit strange to have Context/Factory/ActionContextFactoryInterface
, but no actual ActionContext
as "context" is array and no factoring is happening.
It's more like formatter or provider.
Is there any point adding parameter bag as in TwigHooks for that?
|
||
|
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.
<import resource="services/field_types.xml" /> | ||
<import resource="services/filters.xml" /> | ||
<import resource="services/renderer_context.xml" /> | ||
<import resource="services/templating.xml" /> | ||
<import resource="services/twig.xml" /> |
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.
Just an idea, this approach is less error prone, less code and seems what sylius uses in newer bundles, like ApiBundle.
<import resource="services/field_types.xml" /> | |
<import resource="services/filters.xml" /> | |
<import resource="services/renderer_context.xml" /> | |
<import resource="services/templating.xml" /> | |
<import resource="services/twig.xml" /> | |
<import resource="services/*.xml" /> |
<import resource="services/field_types.xml" /> | |
<import resource="services/filters.xml" /> | |
<import resource="services/renderer_context.xml" /> | |
<import resource="services/templating.xml" /> | |
<import resource="services/twig.xml" /> | |
<import resource="services/**/*.xml" /> |
|
||
<service id="sylius.grid.renderer.context.factory.filter" class="Sylius\Component\Grid\Renderer\Context\Factory\FilterContextFactory" /> | ||
<service id="Sylius\Component\Grid\Renderer\Context\Factory\FilterContextFactoryInterface" alias="sylius.grid.renderer.context.factory.filter" /> | ||
|
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.
Interesting solution here https://github.com/symfony/symfony/blob/7.2/src/Symfony/Component/Serializer/Context/ContextBuilderInterface.php |
In Sylius resource bundle, a Twig Grid renderer decorates the grid one in order to add some data to the context (Twig context here but the renderer does not depends on Twig).
Cause I need to add things on resource side to this context, I think it will be easier to allow decorating that context instead.
Example for the future in Resource package to improve that https://github.com/Sylius/SyliusResourceBundle/blob/1.11/src/Bundle/Grid/Renderer/TwigGridRenderer.php#L64
Cause I will also need to add new context data when using the new routing system.