You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are currently 2 options we can use. There can be a TemplateNotFoundException or a exist method on the TemplateRendererInterface. As feedback from @fabpot here: php-fig/fig-standards#1280 (comment):
Having to catch an exception for non-existing templates was a performance issue in Twig as we have a feature that let you fall back to other templates. So we added a way to check if a template exists that returns a Boolean.
So the exception isn't ideal and a exist method is better. We need to check which
The text was updated successfully, but these errors were encountered:
Another note: an exception does not allow to implement the fallback feature if the only API you have is ->render(), as you don't want the fallback to apply if the template exists but include another template for which we have a failure (with no fallback there). Twig used to be able to use an exception-based logic for that thanks to its loadTemplate API that only loads (and compiles) a template without rendering it (and so without resolving other imports which might trigger the exception as well). Without that, you don't know whether the exception is for your own template or a referenced one.
There are currently 2 options we can use. There can be a TemplateNotFoundException or a exist method on the
TemplateRendererInterface
. As feedback from@fabpot
here: php-fig/fig-standards#1280 (comment):So the exception isn't ideal and a
exist
method is better. We need to check whichThe text was updated successfully, but these errors were encountered: