2012-11-26 131 views
1

我正在做一個列出文件的谷歌驅動器API的捆綁。如果用戶需要授予權限或者已經授予權限,那麼我在IndexAction中有這樣的權限。如果需要,那麼我從谷歌獲得的網址,並重定向到該鏈接。Symfony2無法找到行動的路線

在谷歌控制檯我把作爲重定向鏈接:

www.googlebundle/firstTime 

在我GoogleDriveController我已經得到了

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

而在我的路由我得到這個:

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

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

但是我在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 [] [] 

有誰知道發生了什麼?

+2

可以運行'PHP應用程序/控制檯路由器:debug'和後輸出? – MrGlass

+0

也,你清除你的緩存?路由被緩存,即使在開發中。 – MrGlass

+0

您的.htaccess文件是否正確地將'/ app.php'重寫爲'/'? – Squazic

回答

1

首先確保symfony看到你的路由器規則。

在項目根目錄下把

php app/console router:debug | grep FilesGoogleDriveBundle_firstTime 

你應該得到這樣的事情

FilesGoogleDriveBundle_firstTime GET /firstTime 

的最後一個值是這個動作的URL。

+0

知道它的工作,但只有當我使用'app_dev.php/firstTime'如果我只放'/ firstTime'我得到一個錯誤。 – patricia

+0

在這種情況下,請嘗試清除生產緩存(如MrGlass寫的) – karolhor

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

試試這個。

+0

仍然得到同樣的錯誤:S – patricia

0

似乎是一個緩存的問題,清除督促環境緩存:

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