symfony - @Route directive not working--what am I doing wrong? -


i used composer.phar install symfony 2.2.1 standard edition, , used app/console utility generate "clientbundle".

i'm trying define routes using @route annotation. here's controller:

namespace scrumboard\clientbundle\controller;  use symfony\bundle\frameworkbundle\controller\controller;   class defaultcontroller extends controller {     /**      * @route("/my/route/path")      */     public function indexaction($name)     {         return $this->render('scrumboardclientbundle:default:index.html.twig', array('name' => $name));     } } 

and bundles defined this:

public function registerbundles() {     $bundles = array(         new symfony\bundle\frameworkbundle\frameworkbundle(),         new symfony\bundle\securitybundle\securitybundle(),         new symfony\bundle\twigbundle\twigbundle(),         new symfony\bundle\monologbundle\monologbundle(),         new symfony\bundle\swiftmailerbundle\swiftmailerbundle(),         new symfony\bundle\asseticbundle\asseticbundle(),         new doctrine\bundle\doctrinebundle\doctrinebundle(),         new sensio\bundle\frameworkextrabundle\sensioframeworkextrabundle(),         new jms\aopbundle\jmsaopbundle(),         new jms\diextrabundle\jmsdiextrabundle($this),         new jms\securityextrabundle\jmssecurityextrabundle(),         new acme\hellobundle\acmehellobundle(),         new scrumboard\clientbundle\scrumboardclientbundle(),     );      if (in_array($this->getenvironment(), array('dev', 'test'))) {         $bundles[] = new acme\demobundle\acmedemobundle();         $bundles[] = new symfony\bundle\webprofilerbundle\webprofilerbundle();         $bundles[] = new sensio\bundle\distributionbundle\sensiodistributionbundle();         $bundles[] = new sensio\bundle\generatorbundle\sensiogeneratorbundle();     }      return $bundles; } 

you can see sensioframeworkextrabundle included in list of bundles.

however, when go http://symfony2.localhost/app_dev.php/my/route/path get

error - uncaught php exception symfony\component\httpkernel\exception\notfoundhttpexception: "no route found "get /my/route/path"" @ c:\webdev\scrum-whiteboard\symfony-quickstart\app\cache\dev\classes.php line 3609 

so, i'm missing something... how @route annotations working?

jfyi, if go http://symfony2.localhost/config.php can see symfony2 working. "welcome new symfony project." message, , no config errors noted.

here's how got work. don't know if correct. had 2 things.

first, added routing.yml file:

scrumboardclientbundle:   resource: "@scrumboardclientbundle/controller/"   type:     annotation   prefix:   /scrum 

and added "use" statement @ top of controller:

use sensio\bundle\frameworkextrabundle\configuration\route;

once did this, routes started work. did need add /scrum path, complete path turned into:

http://symfony2.localhost/app_dev.php/scrum/my/other/path

please advise if have done correctly. thanks!


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -