/**
  * method invoked everytime an event is dispatched(guide updates)
  * @param  EguideEvent $event
  */
 public function updateFreeSearchField(EguideEvent $event)
 {
     $eguide = $event->getEguide();
     $keywords = array();
     /**
      * needs improvement
      * @var string
      */
     $categories = $eguide->getCategories();
     foreach ($categories as $category) {
         $categoryName = strtolower($category->getName());
         $keywords[] = 'activity:' . $categoryName;
     }
     $country = strtolower($eguide->getCountry()->getName());
     $locations = $eguide->getLocations();
     foreach ($locations as $location) {
         $address = 'location:' . $location->getAddress();
         $keywords[] = $address;
     }
     $keywords[] = $country;
     $keywords = implode(" ", $keywords);
     $eguide->setFreeSearch($keywords);
     $this->entityManager->persist($eguide);
     $this->entityManager->flush();
 }
 public function handleActivity(EguideEvent $event)
 {
     $eguide = $event->getEguide();
     $eguideActivity = new EGuideActivity();
     $eguideActivity->setDescription($this->getAppropriateDescription($event->getEventType()));
     $eguideActivity->setType($event->getEventType());
     $eguideActivity->setDateAdded(new \DateTime(date('Y-m-d H:i:s')));
     $this->entityManager->persist($eguideActivity);
     $eguideToEguideActivity = new EGuideToEGuideActivity();
     $eguideToEguideActivity->setEGuide($eguide);
     $eguideToEguideActivity->setEGuideActivity($eguideActivity);
     $this->entityManager->persist($eguideToEguideActivity);
     $this->entityManager->flush();
 }