Creating controller with
app/console doctrine:generate:crud
ends up with an error:
[Twig_Error_Loader]
Unable to find template "crud/views/layout.html.twig.twig"
(looked into: ...\vendor\sensio\generator-bundle\Sensio\Bundle\GeneratorBundle\Command/../Resources/skeleton,
...\vendor\sensio\generator-bundle\Sensio\Bundle\GeneratorBundle\Command/../Resources).
In the requested directory I can't find a template like "crud/views/layout.html.twig.twig".
Any help appreciated,
Use find text in the files with Netbeans or Notepad++ for searching next string:
layout.html.twig.twig
maybe you have this template name in any parent templates or your controllers.
Or for test, try to create crud/views/layout.html.twig.twig template and generate crud again.
Related
I'm starting to develop a project that will be quite big (hear lots of files) and I want to have an organization that's different from Symfony's default one: instead of having one dir for all my controllers, another for all my forms, etc, I want to have one dir per functionality, ie a directory for my homepage which will contain the controller, the templates, another dir for the blog page with the controller, forms and templates, and so on.
I tried what was explained in this (old) answer, and it didn't work : my routes weren't recognized, and a php bin/console debug:router showed they weren't listed anymore.
I feel I will have something to adapt in my routes.yaml file, which looks like this for now, and which explains why it doesn't work because it explicitely searches in the src\Controller directory:
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute
I looked in the documentation I found, but I didn't find anything useful (I think I will have to remove the path and change it to something else, but I don't know what yet.
The above solutions are only for differentiating controller and template files. But For Entity, Events, and Forms it will not work.
It seems like you want to separate files for each module or functionality. For example, settings.yaml, controller, entity, forms, events, etc...
For that Symfony provides a Bundle feature. You can create a new Bundle in Symfony and use it as a separate feature. For more details please read this link
im creating a module and would like to override admin controller tpl file. Its admin/theme/controller/orders/_product_line.tpl
I tried to create in module folder: override/controllers/admin/orders and put edited file.
I found a few functions to override, but also it gives me nothing.
If u could share your code or give me advice I would really appreciate it. I can`t find any information about it.
I need to include href to profile/edit in my view. Template engine is twig, so code look like this:
Edit profile
But i get exception:
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "fos_user_profile" as such route does not exist.") in VputiUserBundle:ProfileShow:show.html.twig at line 4.
Please help, where is mistake?
First, debug your router
$ php app/console router:debug --env=[env]
And use the correct environment
If the route shows up, then you probably need to clear the cache
$ php app/console cache:clear --env=[env]
If the route doesn't show up, then whatever bundle that provides that route isn't being loaded correctly.
Also, if you're using a front-controller with debugging turned on, you can check the web debug toolbar.
The message tells it all. Route with name fos_user_profile does not exist.
I guess this route name comes from FOSUserBundle, so check that VputiUserBundle extends it properly.
The path('fos_user_profile') does not exist. It routes to #FOSUserBundle/Resources/config/routing/profile.xml. There you can find the actual usable routes, like:
Edit profile
I'm trying to override the standard error.html.twig template provided by the Symfony2 Twig Bundle.
According to the docs, I just need to place a file error.html.twig in my app/Resources/TwigBundle/views/Exception folder and Symfony should use it.
I am able to specify specific error templates, like error404.html.twig, and those are used. But I'm looking to create a catch all template as well.
Anyone know what could be the issue?
The answer here seems to be clearing your cache after adding or editing your template.
A simple app/console cache:clear should resolve your problems also manually removing the app/cache directory should accomplish the same thing.
Should be simple enough. Everything works in my local environment, but not on my prod server (neither prod nor dev environment). I get an error that the FOS template cannot be found:
Unable to find template "FOSUserBundle::layout.html.twig".
My code is simple:
{% extends "FOSUserBundle::layout.html.twig" %}
I'm going from my local Windows machine to a Linux box. I've read case sensitivity might be the culprit, but it doesn't seem like it.
The FOS bundle is in the normal place: vendor/friendsofsymfony/user-bundle/FOS/UserBundle.
I'm having trouble diagnosing - any ideas? Did things get screwed up when I FTPd? Permissions issues? What are the common gotchas? I'm desparate!
Update: A clue. I ran assetic:dump and got
[RuntimeException]
".../app/Resources/FOSUserBundle/views/layout.html.twig" resource is hidden by a
resource from the "*******Bundle" derived bundle. Create a
".../app/Resources/*******Bundle/views/layout.html.twig" file to override the bundle
resource.
This question seems relevant.
Another update: I was using getParent() in my own bundle to override the templates. I switched to the first method in the docs but now the templates in app/resources simply aren't having an effect. It's going straight to the default form template with a white background.
Any ideas?
It was a upper/lower case/namespacing thing. I thought my local files were in sync with remotes but they were not.
Just check your whole directory & all namespaces in the FOS bundle!
I also encountered the problem and "solved" it by renaming my layout.html.twig inside my bundle's Resources/views folder to bundle-layout.html.twig and adapting my templates accordingly.
I resolved the resource is hidden by a resource error by moving the template in the good bundle extension.
Specifically from app/Resources/FOSUSerBundle/views/ChangePassword
to src/Application/Sonata/UserBundle/Resources/views/ChangePassword
I confounded FOSUser & SonataUser.