patricia
patricia

Reputation: 1103

Symfony2 can't find route for an action

I'm doing a bundle with google drive api that lists files. I have in the IndexAction an if that sees if the user needs to give permission or already gave. If needs, then I get the url from google and redirect to that link.

In google console I put as redirect link:

www.googlebundle/firstTime

In my GoogleDriveController I've got the

public function firstTimeAction() {
       (...)
}

And in my routing I got this:

FilesGoogleDriveBundle_firstTime:
   pattern: /firstTime
   defaults: { _controller: "FilesGoogleDriveBundle:GoogleDrive:firstTime" }
   requirements: { _method: get }

FilesGoogleDriveBundle_homepage:
   pattern:  /Drive/{id}
   defaults: { _controller: FilesGoogleDriveBundle:GoogleDrive:index }

But I get this error in prod.log:

[2012-11-26 16:50:14] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /firstTime" (uncaught exception) at /var/www/Symfony/app/cache/prod/classes.php line 4564 [] []

Does anyone know what's happening?

Upvotes: 1

Views: 3102

Answers (3)

Tito Miguel Costa
Tito Miguel Costa

Reputation: 9

seems like a cache problem, clear the cache for the prod environment:

php app/console cache:clear --env=prod

Upvotes: 0

karolhor
karolhor

Reputation: 302

First make sure that symfony see your router rule.

In project root directory put

php app/console router:debug | grep FilesGoogleDriveBundle_firstTime

You should get something like this

FilesGoogleDriveBundle_firstTime   GET    /firstTime

The last value is the URL for this action.

Upvotes: 1

Alexandru Chelariu
Alexandru Chelariu

Reputation: 477

FilesGoogleDriveBundle_firstTime:
   pattern: /firstTime
   defaults: { _controller: FilesGoogleDriveBundle:GoogleDrive:firstTime }
   requirements: 
       _method: GET

Try this.

Upvotes: 0

Related Questions