Skip to content
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

Fix crud controller template #286

Merged
merged 2 commits into from
Oct 13, 2018
Merged

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