/**
  * @param SiteEvent $event
  */
 public function deleteRouteDocumentOnSiteDelete(SiteEvent $event)
 {
     $routesToClear = $this->routeDocumentManager->clearForSite($event->getSite());
     foreach ($routesToClear as $route) {
         $this->objectManager->remove($route);
     }
     $this->objectManager->flush();
 }
 /**
  * @param SiteEvent $siteEvent
  */
 public function createRootNode(SiteEvent $siteEvent)
 {
     $site = $siteEvent->getSite();
     if (null !== $site) {
         $language = $site->getDefaultLanguage();
         $name = $this->translator->trans('open_orchestra_backoffice.node.root_name');
         $node = $this->nodeManager->createRootNode($site->getSiteId(), $language, $name, self::ROOT_NODE_PATTERN, $site->getTemplateNodeRoot());
         $this->objectManager->persist($node);
         $this->objectManager->flush();
     }
 }
 /**
  * @param SiteEvent $siteEvent
  */
 public function createRootFolder(SiteEvent $siteEvent)
 {
     $site = $siteEvent->getSite();
     /** @var FolderInterface $folder */
     $folder = new $this->folderClass();
     $folder->setSiteId($site->getSiteId());
     $name = $this->translator->trans('open_orchestra_media_admin.folder.root_name');
     $folder->setName($name);
     $this->objectManager->persist($folder);
     $this->objectManager->flush();
 }
 /**
  * @param SiteEvent $event
  */
 protected function updateSiteAliasesIndex(SiteEvent $event)
 {
     $site = $event->getSite();
     $aliases = $site->getAliases();
     foreach ($aliases as $key => $alias) {
         if (strpos($key, SiteInterface::PREFIX_SITE_ALIAS) === false) {
             $site->removeAlias($alias);
             $site->addAlias($alias);
         }
     }
     $this->objectManager->persist($site);
     $this->objectManager->flush($site);
 }
 /**
  * @param SiteEvent $event
  */
 public function siteUpdate(SiteEvent $event)
 {
     $this->sendLog('open_orchestra_log.site.update', $event->getSite());
 }