Closed VincentLanglet closed 5 years ago
I found this
If you use a string that starts with @ or has % anywhere in it, you need to escape it by adding another @ or %:
the @ symbol does NOT need to be escaped in XML
I'm not sure but I think maybe the @
syntax has been deprecated in favor of the second syntax you used. Does anyone else remember something like this?
If I can remember correctly, @
notation is only for registered bundles. If you are trying to use your own templates, you must use a relative path from your templates directory (PostAdmin/edit.html.twig
by instance).
You can also register your own namespaces if required: https://symfony.com/doc/current/templating/namespaced_paths.html#registering-your-own-namespaces.
Then I think, this doc (https://github.com/sonata-project/SonataAdminBundle/blob/master/docs/reference/templates.rst) should be updated.
Do you agree ?
Yes, I think that doc can be improved. Could you please create a PR?
@VincentLanglet, could you please share a reproducer for this issue? Thank you in advance.
@phansys I started a new project for a bug with createQuery and the searchAction. On this project I created a new branch to reproduce the bug of this issue https://github.com/VincentLanglet/sonataBug/pull/1/files
It was a Symfony 4 project, but to do as if it's a Symfony 3 project, I registered the templates folder.
You can see, adding
calls:
- [setTemplate, ['list', '@App/list.html.twig']]
Break the app.
Adding
calls:
- [setTemplate, ['list', '@@App/list.html.twig']]
Does not
This really should be documented at https://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_row_templates.html#row-templates
Can you provide a PR @haivala ?
Dont have time :(
Environment
Sonata packages
Symfony packages
PHP version
Subject
In the doc
There is an example of config
I get
But both this solutions works
Is there an issue with the doc ?