FeatureToggleBundle icon indicating copy to clipboard operation
FeatureToggleBundle copied to clipboard

Why use tokenParser instead of twig function?

Open ivoba opened this issue 10 years ago • 1 comments

I dont really understand what the benefit is of the tokenParser here, as it basically just mimiks an if clause, doesnt it?

However i can see some cons:

  • it needs a cache-clear, a twig function doesnt need a cache-clear when changing the config
  • it cant be used in if/else or tenary clauses
  • codewise its much more verbose

What do you think?

ivoba avatar Nov 28 '14 10:11 ivoba

The reason for this was to execute the most of the code on Twig compilation and reduce performance impact on page rendering. This may or may not be justified / implemented correctly ;)

marekkalnik avatar May 26 '15 08:05 marekkalnik