How can I override Core Symfony2 Classes?

后端 未结 2 733
长情又很酷
长情又很酷 2021-01-24 07:42

I want to override a core Symfony2 Class.

Specifically I want to override vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php, th

2条回答
  •  不要未来只要你来
    2021-01-24 07:46

    You can easily override some classes defined as service (you can check on app/cache/dev/appDevDebugProejctContainer.xml), and override the service name on your parameter.ini.

    BUT if the class it not defined like this, you can create your own "patch" you apply after a composer update.

    Lot of people will say its dirty to edit core classes, but if you want good performance, its often the only solution to achieve it ;-), its simple, fast & easy.

    Other solutions are welcome ..

提交回复
热议问题