I need help with symfony, how to do the routing and add the page to the finished project, this is where I added the new routing: src / BlogBundle / Resources / config / routing_news.yml here is the code:
reset:
path: / reset_mail
defaults: {_controller: BlogBundle: Page: reset_mail}
Then I added to the controller: src / BlogBundle / Controller / PageController.php code:
public function reset_mail(Request $request)
{
$pageRepository = $this->getDoctrine()->getRepository('AdminBundle: reset_mail');
$page = $pageRepository->findOneBy([
'path' => 'page / reset_mail'
]);
return $this->render('BlogBundle: Page: reset.html.twig', [
'title' => $page->getTitle()
]);
}
Well, I created the file: reset.html.twig in src / BlogBundle / Resources / views / Page. So this is what I did wrong, because when I go to this / page / reset_mail, nothing happens. What I did wrong, and how to do it right?
You should use annotations for your routing.
https://symfony.com/doc/current/routing.html
It's good practice ( https://symfony.com/doc/current/best_practices.html#don-t-use-annotations-to-configure-the-controller-template ).
It's really simple to use annotation and better.
Hope that's will be useful.
Cheers !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.