更新时间:2023-11-19 21:11:22
将此别名方法添加到控制器修复问题:
public function getDoctrine()
{
return $ this-> container-> get('doctrine');
}
When I override FOSUserBundle's ProfileController
and add these lines:
$em = $this->getDoctrine()->getManager();
$resultat = $em->getRepository('PublishDemandsBundle:Demands')->findAll();
I get the following error:
Call to undefined method Register\UserBundle\Controller\ProfileController::getDoctrine() in ProfileController.php.
Adding this alias-method to the controller fixed the issue:
public function getDoctrine()
{
return $this->container->get('doctrine');
}
Symfony2 - 调用未定义的方法getDoctrine()覆盖FOSUserBundle的ProfileController
错误“调用未定义的方法Illuminate \ Auth \ GenericUser".访问Auth :: user()的hasMany关系时
PHPunit 未捕获错误:调用未定义的方法 PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()
Laravel-调用未定义的方法Illuminate \ Foundation \ Application :: share()
调用未定义的方法Illuminate \ Foundation \ Application :: bindShared()