2012-01-03 105 views
2

可能重複:
Symfony - Form requested url not found張貼到sfDoctrineRoute

我工作的symfony項目。 我正在使用一種不會重定向到自己頁面的表單。 action屬性設置爲「」並且方法設置爲發佈。在這種情況下,它應該調用相同的頁面,但我在404頁面結束。

有趣的是,當我從網址中調用網頁時,網址正確顯示,404僅在提交表單時出現。
當我在我的shell中運行:php symfony app:routes frontend時,它表示該方法設置爲頭並得到。但它甚至沒有設置在routing.yml中,如果我在路由中做出任何要求,404仍然顯示出來。這裏是我的路由:

stories_detail: 
    url: /stories-of-the-month/:slug 
    class: sfDoctrineRoute 
    param: { module: stories, action: detail} 
    options: { model: Article, type: object, method: doSelectForSlug } 
    requirements: 
    sf_method: any 

我怎樣才能讓我的網頁接受這個職位的方法?

回答

4

默認sfDoctrineRoute對象只接受get/head請求,這是初學者常見的陷阱。這是正確的要求:

sf_method: [get, post]