在FOSUBUserProvider类中使用$ getDoctrine():

时间:2014-12-01 15:48:54

标签: php symfony doctrine response

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

}

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

  

在FOSUBUserProvider

中找不到错误方法getDoctrine()

1 个答案:

答案 0 :(得分:0)

your.service_id:     class:Acme \ DemoBundle \ Timesheet     参数:[@ doctrine]

私人$ doctrine;

/**
 * @param Registry $doctrine Doctrine
 */
public function __construct(Registry $doctrine)
{
    $this->doctrine = $doctrine;
}

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