2014-12-01 37 views
-1
public function loadUserByOAuthUserResponse(UserResponseInterface $response) 
{ 
    $em = $this->getDoctrine()->getManager(); 

} 

然後我收到以下錯誤信息:

錯誤方法getDoctrine()內FOSUBUserProvider

+0

它在什麼級別?這是一項服務嗎? – Koalabaerchen 2014-12-01 15:52:02

+0

看看:http://stackoverflow.com/questions/27226728/how-to-get-session-value-inside-symfony2-i-use-fosuserbundle – ahmadox 2014-12-01 15:52:52

回答

0

your.service_id未發現: 類:Acme \ DemoBundle \ Timesheet arguments:[@doctrine]

private $ doctrine;

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

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