symfony - Symfony2 multiple @template in a controller -
i new symfony2 , trying hard past few days figure out problem. controller is
<?php namespace myname\adminbundle\controller; use symfony\bundle\frameworkbundle\controller\controller; use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\template; class defaultcontroller extends controller { /** * @route("/admin/{type}/{nav}", defaults={"nav"="nil"}) * @template("mybundle::index.html.twig") */ public function indexaction($type, $nav) { return array('type' => $type, 'nav' => $nav); } /** * @route("/mylink/accounts", name="page_accounts") * @template("mybundle::accounts.html.twig") */ public function accountsaction() { return $this->render('mybundle::accounts.html.twig'); } }
but problem facing is, ever link trying use, using first defined template , second template never rendered. if remove first template code, second 1 working perfectly. comments great stuck last 4 days. in advance.
i not sure understand issue. however, think there issues controller , how using @template annotation.
first, if following default conventions, don't need specify template use. also, when using @template annotation, supposed return array.
if none of helps or related, please clarify more?
class defaultcontroller extends controller { /** * @route("/admin/{type}/{nav}", defaults={"nav"="nil"}) * @template */ public function indexaction($type, $nav) { return array('type' => $type, 'nav' => $nav); } /** * @route("/mylink/accounts", name="page_accounts") * @template */ public function accountsaction() { return array(); } }
Comments
Post a Comment