N
N
Nikolai Egorov2017-08-19 14:12:36
symfony
Nikolai Egorov, 2017-08-19 14:12:36

Do I need to register Twig Extensions in services.yml config? It works for me as well. New feature or bug?

I am training in Symfony3 at https://knpuniversity.com, I got to creating my own filters in Twig ( https://knpuniversity.com/screencast/symfony-servi... In this video, the author creates a filter class, but when using this filter in the template:
<dd>{{ genus.funFact|<b>markdownify</b> }}</dd>
in the video symphony crashes with an error, and the author of the video says that in order for the filter to work, symphony needs to be told to use this Twig filter.This is done by registering the Twig extension as a service in services.yml.But, Everything worked for me right away, no errors.Do
I need to register Twig Extensions in the services.yml config?
I have Symfony 3.3.6 (in the video 3.0.0)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2017-08-21
@nickicool

Version 3.3 has PSR-4 service discovery and autowire and autoconfigure options that automatically register services, resolve dependencies, and configure tags.
Here is the code that does this: https://github.com/symfony/symfony-standard/blob/3. ..
I would recommend using these features, they greatly speed up development. Of the minuses: subsidence in the speed of generating pages in debug mode due to container regeneration.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question