Esempio n. 1
0
 /**
  * @param $element
  * @param $searchIndex
  */
 public function getTagsForElementAndSave($element, $searchIndex)
 {
     /*
      * We bound orm with ElasticSearch at this point. I could separate the logic but this
      * means that we will have logic duplication. Maybe this could be refactored in the future.
      */
     $elasticaDocument = $this->transformer->transform($element, array_flip(array_keys($this->config['filters']['facets'])));
     $searchIndex->setTags(serialize($elasticaDocument->getData()));
     $this->em->persist($searchIndex);
     $this->em->flush();
 }
 /**
  * @return ModelToElasticaAutoTransformer
  */
 private function getTransformer()
 {
     $transformer = new ModelToElasticaAutoTransformer();
     $transformer->setPropertyAccessor(PropertyAccess::getPropertyAccessor());
     return $transformer;
 }
 /**
  * @param null|\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
  *
  * @return ModelToElasticaAutoTransformer
  */
 private function getTransformer($dispatcher = null)
 {
     $transformer = new ModelToElasticaAutoTransformer(array(), $dispatcher);
     $transformer->setPropertyAccessor(PropertyAccess::createPropertyAccessor());
     return $transformer;
 }