2014-02-28 1 views
0

doctrine orm을 사용하는 config.yml에서 신축성있는 검색 매핑을 만들었습니다. 문제는 새 문서를 만들 때 색인이 맨 위에있는 " 문서 "는 아니지만"폴더, 작성자, 댓글 ... "과 같은 자식 개체가 아니라면 플래그 나 설정이 누락 된 경우 누군가 제안 할 수 있습니다. 아래는 내 Elastica 구성입니다.fos elastica의 자동 인덱스 하위 객체

Thnx.

답변

0

여기 해결책을 찾았습니다. Symfony2 FOSElasticaBundle update index for all entities related to the entity updated

참고 : FOSElastica의 내 버전에서는 리스너는 ORM 폴더에 있지만 FOS \ ElasticaBundle \ 교리에없는 인수는 교리 \ 공통 \ EventArgs입니다 $있는 EventArgs를 \하는 LifecycleEventArgs $ EventArgs입니다 변경되었습니다.

편집 :이 경우에는 postPersist도 무시해야합니다.

public function postPersist(\Doctrine\Common\EventArgs $eventArgs) 
{ 

    $entity = $eventArgs->getEntity(); 


    if ($entity instanceof $this->objectClass && $this->isObjectIndexable($entity)) { 

     $this->scheduledForInsertion[] = $entity; 
     $this->inicializaPost(); 
     $this->objectPersisterPost->replaceOne($entity->getPost()); 
    } 
} 
+0

isObjectIndexable - 회원 provate 액세스, 그리고이 있습니다 오류 런타임 공지 사항 : 아르 텔의 선언은 \ SiteBundle \의 EventListener \ ElasticaCourseListener :: postUpdate()는 FOS \ ElasticaBundle \ 교리 \ 수신기와 호환되어야합니다 :: postUpdate (Doctrine \ Common \ Persistence \ Event \ LifecycleEventArgs $ eventArgs)에 있습니다. –