Skip to content

Conversation

@thlbaut
Copy link

@thlbaut thlbaut commented Oct 10, 2018

There is a mistake in crud controller template :

Example (src/Resources/skeleton/crud/controller/Controller.tpl.php - line 35) :
return $this->render('<?= $route_name ?>/index.html.twig', ['<?= $entity_twig_var_plural ?>' => $<?= $entity_var_plural ?>]);

With an entity with following path : Entity/Foo/BarBar.php , $route_name will be equal to foo_bar_bar and does not correspond with the index.html.twig path (should be foo/bar_bar).

This pull request fix this by adding the $templatesPath var, used to create twig templates, for the controller generation.

:)

@weaverryan
Copy link
Member

Very well-explained and an excellent patch! Thank you @thlbaut!

@weaverryan weaverryan merged commit f77a843 into symfony:master Oct 13, 2018
weaverryan added a commit that referenced this pull request Oct 13, 2018
This PR was squashed before being merged into the 1.0-dev branch (closes #286).

Discussion
----------

Fix crud controller template

There is a mistake in crud controller template :

Example  (`src/Resources/skeleton/crud/controller/Controller.tpl.php` - line 35) :
`return $this->render('<?= $route_name ?>/index.html.twig', ['<?= $entity_twig_var_plural ?>' => $<?= $entity_var_plural ?>]);`

With an entity with following path :` Entity/Foo/BarBar.php` , `$route_name` will be equal to `foo_bar_bar` and does not correspond with the `index.html.twig` path (should be `foo/bar_bar`).

This pull request fix this by adding the `$templatesPath` var, used to create twig templates, for the controller generation.

:)

Commits
-------

f77a843 Rename template_var with templates_path (plural)
86d24f3 Create new template_path var and replace route_name var in render method parameter in controller template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants