2013-04-06 60 views
3

我遵循本指南,以創建一個RESTful API: http://williamdurand.fr/2012/08/02/rest-apis-with-symfony2-the-right-way/Symfony的:使對象到控制器的方法

在POST部分,它使用對象的用戶作爲其編輯方法的輸入。我想與我的控制器類是相同的,但我發現了以下錯誤:

Unable to guess how to get a Doctrine instance from the request information

有人可以幫我嗎? 謝謝

更新:

現在方法的定義是這樣的:

/** 
    * @Route("/rest/categories/{id}") 
    * @ParamConverter("category", class="TouristAppCoreBundle:Category") 
    * @Template() 
    */ 
    public function rest_editAction(Category $category) 
+3

此錯誤與ParamConverter在從數據庫中提取實體時無法猜測使用哪個字段有關。您是否閱讀過ParamConverter文檔? http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html – 2013-04-06 20:25:45

回答

相關問題