2014-09-11 1 views
0

내가 가지고 심포니 프로젝트의 교리 저장소에 대한 다음과 같은 서비스 정의 :PhpStorm 교리 저장소에 심포니 공장 서비스를 처리하지 제대로

my_custom_repository_service: 
    class: My\Custom\ClassName 
    factory_service: doctrine.orm.entity_manager 
    factory_method: getRepository 
    arguments: [MyCustom:ClassName] 

이 같은이 서비스 전화 :

$repository = $this->container->get('my_custom_repository_service') 

PhpStorm을 $repository은 실제로 존재하는 Doctrine 저장소 대신에 My\Custom\ClassName이라고 생각합니다. 이 문제를 해결할 수 있습니까?

답변

1

당신은 Doctrine\ORM\EntityRepository로 서비스의 class 속성을 변경해야합니다 : 그것은 정말이 경우에는 문제가되지 않습니다

my_custom_repository_service: 
    class: Doctrine\ORM\EntityRepository 
    factory_service: doctrine.orm.entity_manager 
    factory_method: getRepository 
    arguments: [MyCustom:ClassName] 

를 저장소 공장은 당신이로 전달하는 클래스의 인스턴스를 생성하기 때문에 인수 (Doctrine \ ORM \ EntityRepository의 하위 클래스 여야합니다.)하지만 PHPStorm이이를 받아들이면이를 수정합니다.

+0

그 방법은'find'와 같은 내장 리포지터리 기능만을 사용할 때만 작동하지만 사용자 정의 저장소 클래스에 코드 완성 기능을 사용할 수 없습니다. –

+0

사실, 방금 내 이름을 정확한 저장소에 저장하려고 시도했는데 문제가 해결되었습니다. 고맙습니다! –

관련 문제