2
我想在我的symfony API項目中使用的學說,我有這樣的控制器,但是當它被稱爲我的錯誤「ServiceNotFoundException的」Symfony的2 ServiceNotFoundException的
<?php
namespace Cogc\EnquirerAPIBundle\Controller;
use FOS\RestBundle\Controller\FOSRestController;
use Doctrine;
class PageController extends FOSRestController
{
public function getPageAction($id)
{
return $this->container->get('doctrine.entity_manager')->getRepository('Page')->find($id);
}
}
嘗試通過命令行'傾銷您的集裝箱服務deifinition PHP的應用程序/控制檯容器:調試'在我的情況下,該服務命名爲'doctrine.orm.entity_manager' – Matteo 2015-01-15 15:52:39
啊,這工作。謝謝 – aaaa 2015-01-15 15:59:55
好吧,我發表我的評論作爲答案,所以你可以關閉這個問題 – Matteo 2015-01-15 16:02:17