Ejemplo n.º 1
0
 protected function getEventManager()
 {
     $em = new EventManager();
     $em->addEventSubscriber(new \Knp\DoctrineBehaviors\ORM\Geocodable\GeocodableSubscriber(new ClassAnalyzer(), false, 'Knp\\DoctrineBehaviors\\Model\\Geocodable\\Geocodable', function ($entity) {
         if ($location = $entity->getLocation()) {
             return $location;
         }
         return Point::fromArray(['longitude' => 47.7, 'latitude' => 7.9]);
     }));
     return $em;
 }
Ejemplo n.º 2
0
 protected function getEventManager()
 {
     $em = new EventManager();
     $em->addEventSubscriber(new \Knp\DoctrineBehaviors\ORM\Geocodable\GeocodableListener(function ($entity) {
         if ($location = $entity->getLocation()) {
             return $location;
         }
         return Point::fromArray(['longitude' => 47.7, 'latitude' => 7.9]);
     }));
     return $em;
 }