Php 在FOSUBUserProvider类中使用$getDoctrine():

Php 在FOSUBUserProvider类中使用$getDoctrine():,php,symfony,doctrine,response,Php,Symfony,Doctrine,Response,然后,我收到以下错误消息: 在FOSUBUserProvider中找不到错误方法getDoctrine() 您的.service\u id: 类别:Acme\DemoBundle\Timesheet 论点:[@document] 私人主义 public function loadUserByOAuthUserResponse(UserResponseInterface $response) { $em = $this->getDoctrine()->getManager();

然后,我收到以下错误消息:

在FOSUBUserProvider中找不到错误方法getDoctrine()

您的.service\u id: 类别:Acme\DemoBundle\Timesheet 论点:[@document]

私人主义

public function loadUserByOAuthUserResponse(UserResponseInterface $response)
{
    $em = $this->getDoctrine()->getManager();

}

它在几班?这是一项服务吗?请看:
/**
 * @param Registry $doctrine Doctrine
 */
public function __construct(Registry $doctrine)
{
    $this->doctrine = $doctrine;
}

public function yourMethod()
{
  $this->doctrine->getRepository('UtilisateurBundle:compte')->find('1');
}