-
Notifications
You must be signed in to change notification settings - Fork 380
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 Lazy-Loaded Twig Extension #1376
Conversation
Sorry @dmaicher just checked again and this question was rulled out here sulu/sulu#5556 (comment)_ in someone else attempt to stop loading this extension. Feel free to close then, I'll disable this extension per project I guess. |
@emmanuelballery I'm not a member on this repo 😉 I just stumbled across your PR as I also noticed the non-lazy twig extension and all the services that are instantiated although mostly not used in my case. So I would like to see this implemented 👍 I believe this would need to go to |
Maybe we can figure out a non BC breaking approach and then I would be fine to have something like this in 2.x /cc @fbourigault |
One way of achieving this with BC would be to
Then on 3.0 we could remove the old one and always use the lazy one with the runtime. Or does someone have a better idea? |
I'd:
liip_imagine.templating.filter_extension:
class: Liip\ImagineBundle\Templating\LazyFilterExtension
tags: [ 'twig.extension' ] Then in 3.x register |
both approaches sound fine for me. FYI if you rebase, PHPCS fixer should work again. |
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 would have preferred the other approach with a simpler upgrade path for the users but this is also fine for me 👍
@dmaicher Maybe I did not completely understand your first suggestion. I was under the impression you were asking to add a configuration and that this configuration would then be obsolete in
liip_imagine.templating.filter_extension:
class: Liip\ImagineBundle\Templating\LazyFilterExtension
tags: [ 'twig.extension' ]
liip_imagine.templating.filter_runtime:
class: Liip\ImagineBundle\Templating\FilterRuntime
arguments: [ '@liip_imagine.cache.manager' ]
tags: [ 'twig.runtime' ] I'm completly ok to work on your approach if maintainers wants me to 👍🏻 |
The downside of your approach is that users might see a deprecation notice since they are using the old filter. Then what do they do? They would need to find this PR (or check the CHANGELOG or so) to find out that they need to register a service themselves to fix it. Then once 3.0 is released they need to remember to remove that custom service definition again as it works without then. So my idea was to make this a bit simpler. They get a deprecation because of the added config option. They set it to true and for 99.9% of all users this works fine. Only if someone extended the filter or so they need to rework it. But in the end its not for me to decide 😊 I'm fine with both options |
@lsmith77 how can we move this forward? 😊 Can I help somehow? |
Friendly ping 😊 Can a maintainer review this? |
sorry for the long silence. i have no some time reserved each week to keep LiipImagineBundle alive. i added some minor comments, but like where this is going. can you please have a look at them? and can you please rebase the branch on 2.x to get the latest changes and ci-adjustments in? |
God ... I messed up 😞 |
can you please rebase on 2.x? that should improve the build situation... i think the 8.0 test failure is because of our deprecation warnings. afaik we need to mark the tests for deprecated things with |
added extension fixed var name
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.
great, i am happy with this now!
one last thing: can you please document the new twig_mode option in /~https://github.com/liip/LiipImagineBundle/blob/2.x/Resources/doc/configuration.rst?
I used this code in my projects and found some stupid mistakes ... sorry.
|
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.
awesome, thanks a lot!
thanks for having tested it. the mistake with the configuration would hopefully also have shown when github runs the tests. (it is always waiting for my confirmation in PRs from non repository members, afaik because some assholes started mining bitcoin on ci runners...) can you please look at the cs fixer? and try the
|
cheers! i will look into releasing a new minor version hopefully this wednesday. |
@dbu I may have broken the configuration doc ... 😞 I guess I had to add 2 spaces before each new line for it to work. /~https://github.com/liip/LiipImagineBundle/blob/2.x/Resources/doc/configuration.rst |
thanks for the heads up. fixing this in #1396 |
Hi!
This is a new version for #1265 ;
Twig supports Lazy-Loaded Extensions since
1.35.0
and2.4.4
.Tests have been updated too.
(Also, @mbabker provided details and Blackfire comparison in #1261)