-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[WIP] Explicitly Declare Twig "Paths", deprecate old syntaxes #13928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…() method This is meant to replace the @fosuser Twig syntax AND the FosUserBundle:Register:register.html.twig syntax. Though, those haven't been deprecated yet
👍 |
} | ||
|
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing final new line feed :)
Just some thoughts on this PR:
|
@weaverryan 👍 I like this proposal. @wouterj I think this proposal is mainly aimed at third-party bundles, so answering your concerns:
For application bundles we don't need to provide a default fallback because, in the first place, you should store the templates where they suppose to be:
Currently, my main concern about integrating Puli into Symfony is not technical. Bernhard, our dear Symfony fellow and Puli author, seems to have abandoned the Symfony community. If that's true, this integration cannot happen because Symfony only integrates things if their authors are closely and actively related to Symfony.
If I'm right and this is mainly aimed for third-party bundles, this is not a problem but a good thing. |
Let's also take into consideration that:
|
FYI - I'm pausing on this only so that I can investigate the Puli approach. Puli is trying to solve some of the same problems that we have, and Bernhard has already promised to help let me bother him :). But, I'm very committed to solving how we setup resource paths and overrides before later this year. Cheers! |
Just for the record, I haven't :) I just have been very busy over the last months, otherwise Puli wouldn't be nowhere near where it is now. My original goal was always to build a tool to solve the resource issues we have in Symfony, while fixing the same issues for the PHP community as a whole. So yes, I will work on Puli's integration in Symfony and I will also return to work on my usual topics. But I could definitely need help, as I'm still just one person. :) |
Really nice PR, I like it! |
While I think that it is a good idea to let bundle explicitly register template resources, I am not convinced that removing the existing "magic" is really needed. This would now force most developers to register the "default namespace" again (I guess most people do want to use that). |
@xabbuh yep, this PR is too much. I am still interested in deprecating the |
Hallo!
Comments warmly appreciated. Actually, that's the whole point of pushing this early :).
Deprecated the
AcmeDemoBundle:Foo:default.html.twig
syntax.Deprecated the automatic
@AcmeDemo
-style Twig namespace functionalityAdded a way for bundles to explicitly add a namespaced path. Usage:
then (because this is how Twig paths already work):
This is a lot more flexible than the "automatic" mapping and a lot more clear (because it's explicit) . It still maintains the "fallback" functionality (e.g. put something in
app/Resources/AcmeDemoBundle/...
to override) and everything works the same if the bundle decides to use a namespace that matches its bundle name.This is a small step to removing some "automatic" magic that bundles give us. I'd like to see things more explicit in the bundle - e.g.
$this->addPublicDirectory(__DIR__.'/Resources/public', 'fos_foo')
and even translation resource loading, validation metadata, etc.TODO
TemplatePathsCacheWarmer
) is currently (before this PR) broken, as it doesn't take into account Twig namespace paths.$templateLocator->find('@FOSFooBundle/smarty/ohno.tpl')
- I can't do that. If we agree, we can move the "path" functionality into some templating service that Twig uses.Thanks!