2016-11-25 11 views
0

를 사용하여 가져 오기 : 'connectoauth2' 잘 작동하고 내 나머지 API를 인증합니다.

문제는 내가 그래서

로 공장에서 한에 getIdentity 내 UserEducation 서비스에
$connectDb = $services->get('connectDb'); 
$connectOAuth2 = $services->get('connectoauth2'); // --> service is not found 
$service = new \ConnectApp\Service\UserEducation($connectDb, $connectOAuth2); 
return new UserEducationResource($service); 

오류를이 'connectoauth2'을 주입 할 수 있습니다 : 공장에 서비스를 " connectoauth2 "를 해결 할 수 없습니다; 구성 중에 제공 한 것이 확실합니까?

인증도 정상적으로 작동하지만 여전히 데이터베이스와 마찬가지로 서비스를받을 수 없습니다.

도와주세요!

감사합니다.

+0

구성에 사용한 코드를 확인해야합니다. – Andrew

답변

0

$services이 (가) 서비스 관리자입니까? 또 다른 서비스 로케이터의 인스턴스 인 경우 (예를 들어 ControllerManager 또는 ViewHelperManager 아닌 서비스 관리자)는 먼저 서비스 로케이터에서 서비스 매니저를 얻을 수있을 것이다 : 다음

$serviceManager = $services->getServiceLocator(); 

와 서비스 관리자에서 서비스 : 다른 모든 서비스 로케이터의 개요

$service = $serviceManager->get('connectoauth2'); 

확인도 here

0

단지 Authentication Adapter하지 Authentication Service 즉. 따라서 Authentication에서 identity을 검색해야하는 경우 Authentication Service을 사용해야합니다. 젠드 프레임 워크에서는이

$authentication = $serviceManager->get('authentication'); 

같은 Authentication Service를 호출하고이 같은 identity를 검색 할 수 있습니다.

$authentication->getIdentity()