jeudi 2 octobre 2014

Symfony2: Creating Actions as new pages in same Controller


Vote count:

0




I have two Actions in my controller and I want them both to play as separate pages.


Controller:



public function indexAction(Request $request) {

//...

return $this->render('ProjectProjectBundle:Default:index.html.twig', array(...));
}

public function logoutAction() {

return new Response('<html><body>Hello<body></html>');
}


Routing.yml:



project_project_homepage:
path: /index
defaults: { _controller: ProjectProjectBundle:Default:index }

logout:
path: /logout
defaults: { _controller: ProjectProjectBundle:Default:logout }


So index Action seems to be working when I enter url including /index, but logout is not. I get error No route found for "GET /logout"


Any ideas how to manage it, or should I create separate controlers for each page?



asked 2 mins ago







Symfony2: Creating Actions as new pages in same Controller

Aucun commentaire:

Enregistrer un commentaire