src/Aqarmap/Bundle/ListingBundle/EventListener/LocationSubscriber.php line 27
<?phpnamespace Aqarmap\Bundle\ListingBundle\EventListener;use Aqarmap\Bundle\ListingBundle\Event\LocationSlugUpdateEvent;use Aqarmap\Bundle\ListingBundle\Service\Contracts\LocationManagerInterface;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Contracts\EventDispatcher\Event;class LocationSubscriber implements EventSubscriberInterface{public function __construct(private readonly LocationManagerInterface $locationManager){}/*** @throws \Doctrine\ORM\ORMException* @throws \Doctrine\ORM\OptimisticLockException*/public function onUpdate(Event $event): void{$location = $event->getLocation();$this->locationManager->updateFullPath($location,json_encode($this->locationManager->getFullPathWithId($location), true));$this->locationManager->updateDisabledChildren($location);}public function updateChildrenSlugs(LocationSlugUpdateEvent $event){$slugs = $event->getSlugs();if (!isset($slugs['oldSlug'], $slugs['newSlug'])|| $slugs['oldSlug'] == $slugs['newSlug']) {return true;}return $this->locationManager->updateChildrenSlug($slugs['oldSlug'], $slugs['newSlug']);}public static function getSubscribedEvents(): array{return ['location.got.touched' => 'onUpdate','location.slug.touched' => 'updateChildrenSlugs',];}}