merged branch juliendidier/twig-security-class (PR #2835)
merged branch juliendidier/twig-security-class (PR #2835)

Commits
-------

60ebaaa [SecurityBundle] fix service class by adding a parameter, on twig extension

Discussion
----------

[SecurityBundle] fix service class by adding a parameter, on twig extension

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

To override the is_granted twig function, the class of TwigExtension is now set in a parameter.

---------------------------------------------------------------------------

by stof at 2011/12/10 10:38:38 -0800

First thing, you could overwrite the extension at the twig level by simply registering another twig extension with the same ``getName`` method.

And second point, replacing core Twig functions is probably one of the best way to forbid you to use third party bundles as the change will also impact their code. Do you really need to do it (especially considering that this function simply calls the security context and all the logic is in the context) ?

---------------------------------------------------------------------------

by juliendidier at 2011/12/10 15:43:08 -0800

Yes, overriding ```is_granted``` function is probably a bad example. But having it set as parameter allow you to redefine it (if you know what you are doing).

symfony/security-bundle