Skip to content
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

How to override Twig_Environment? #29024

Closed
rubenrubiob opened this issue Oct 30, 2018 · 2 comments
Closed

How to override Twig_Environment? #29024

rubenrubiob opened this issue Oct 30, 2018 · 2 comments

Comments

@rubenrubiob
Copy link

Hi!

Due to twigphp/Twig#2761 , I want to override Twig_Environment temporarily in my Symfony application.

I have tried to do so decorating the service,, with a service decoration following https://symfony.com/doc/current/service_container/service_decoration.html and with this configuration:

    Twig\Environment:
        class: Infrastructure\Twig\Environment\Environment
        decorates: twig
        decoration_inner_name: twig.inner
        arguments: ['@twig.inner']
        autowire: false

But it does not work.

I have also tried making my Twig_Environment class a child of the twig service, but it does not use my class, it still uses the original Twig_Environment class. The configuration that I tried (one of them) is:

    Twig_Environment:
        parent: Twig\Environment
        autoconfigure: false
        public: true
        class: Infrastructure\Twig\Environment\Environment
        autowire: false

Is there any way to do so? I want to avoid passing all the parameters to the constructor, as it is only a temporary solution and I do not want to interfere with the original class.

Thank you!

Regards!

@xabbuh
Copy link
Member

xabbuh commented Oct 30, 2018

I am sorry, but I have to close your issue as we use GitHub issues only to discuss new features and for bug reports. For support, please refer to one of the support channels. Thank you for understanding.

@xabbuh xabbuh closed this as completed Oct 30, 2018
@rubenrubiob
Copy link
Author

I will do so, no problem, thank you!

I checked the support channels but I though it was best suited here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants