/**
  * @param ModelSaveEvent $event
  */
 public function insertUriAlias(ModelSaveEvent $event)
 {
     $formData = $event->getRawData();
     if ($event->getModuleName() !== Schema::MODULE_NAME && !empty($formData['seo_uri_pattern'])) {
         $this->uriAliasManager->insertUriAlias(sprintf($formData['seo_uri_pattern'], $event->getEntryId()), $formData['alias'], $formData['seo_keywords'], $formData['seo_description'], (int) $formData['seo_robots']);
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if (!$event->isDeleteStatement()) {
         return;
     }
     $this->cache->saveCache();
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function generateSeoSitemap(ModelSaveEvent $event)
 {
     if ($this->canGenerateSitemapAutomatically() && $this->isAllowedModule($event->getModuleName())) {
         try {
             $this->sitemapGenerationModel->save();
         } catch (SitemapGenerationException $e) {
             $this->logger->info('seo-sitemap', $e->getMessage());
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if (!$event->isDeleteStatement()) {
         return;
     }
     $upload = new Upload($this->applicationPath, Schema::MODULE_NAME);
     foreach ($event->getEntryId() as $entryId) {
         $upload->removeUploadedFile($this->emoticonRepository->getOneImageById($entryId));
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if ($event->isDeleteStatement()) {
         return;
     }
     foreach ($event->getEntryId() as $entryId) {
         $category = $this->categoryRepository->getCategoryDeleteInfosById($entryId);
         $upload = new Upload($this->appPath, Schema::MODULE_NAME);
         $upload->removeUploadedFile($category['picture']);
     }
 }
 /**
  * @param ModelSaveEvent $event
  * @throws SuperUserNotDeletableException
  */
 public function forbidSuperUserDelete(ModelSaveEvent $event)
 {
     if (!$event->isDeleteStatement()) {
         return;
     }
     foreach ($event->getEntryId() as $item) {
         $user = $this->userModel->getUserInfo($item);
         if ($user['super_user'] == 1) {
             throw new SuperUserNotDeletableException();
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function generatePictureAliases(ModelSaveEvent $event)
 {
     if ($this->aliases && $this->metaStatements && $this->uriAliasManager) {
         $galleryId = $event->getEntryId();
         $pictures = $this->pictureRepository->getPicturesByGalleryId($galleryId);
         $alias = $this->aliases->getUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId), true);
         $seoKeywords = $this->metaStatements->getKeywords(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         $seoDescription = $this->metaStatements->getDescription(sprintf(Gallery\Helpers::URL_KEY_PATTERN_GALLERY, $galleryId));
         foreach ($pictures as $picture) {
             $this->uriAliasManager->insertUriAlias(sprintf(Gallery\Helpers::URL_KEY_PATTERN_PICTURE, $picture['id']), !empty($alias) ? $alias . '/img-' . $picture['id'] : '', $seoKeywords, $seoDescription);
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if (!$event->isDeleteStatement()) {
         return;
     }
     foreach ($event->getEntryId() as $item) {
         if ($this->commentsHelpers) {
             $this->commentsHelpers->deleteCommentsByModuleAndResult($this->modules->getModuleId(Schema::MODULE_NAME), $item);
         }
         $this->cache->getCacheDriver()->delete(Cache::CACHE_ID . $item);
         if ($this->uriAliasManager) {
             $this->uriAliasManager->deleteUriAlias(sprintf(Helpers::URL_KEY_PATTERN, $item));
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if ($event->isDeleteStatement()) {
         return;
     }
     foreach ($event->getEntryId() as $entryId) {
         $this->articlesCache->getCacheDriver()->delete(Cache::CACHE_ID . $entryId);
         $uri = sprintf(Helpers::URL_KEY_PATTERN, $entryId);
         if ($this->manageMenuItemHelper) {
             $this->manageMenuItemHelper->manageMenuItem($uri, false);
         }
         if ($this->uriAliasManager) {
             $this->uriAliasManager->deleteUriAlias($uri);
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if (!$event->isDeleteStatement()) {
         return;
     }
     $upload = new Upload($this->applicationPath, Schema::MODULE_NAME);
     foreach ($event->getEntryId() as $item) {
         $upload->removeUploadedFile($this->filesRepository->getFileById($item));
         if ($this->commentsHelpers) {
             $this->commentsHelpers->deleteCommentsByModuleAndResult($this->modules->getModuleId(Schema::MODULE_NAME), $item);
         }
         $this->cache->getCacheDriver()->delete(Cache::CACHE_ID . $item);
         if ($this->uriAliasManager) {
             $this->uriAliasManager->deleteUriAlias(sprintf(Helpers::URL_KEY_PATTERN, $item));
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     if (!$event->isDeleteStatement()) {
         return;
     }
     foreach ($event->getEntryId() as $item) {
         if (!empty($item) && $this->menuRepository->menuExists($item) === true) {
             // Delete the assigned menu items and update the nested set tree
             $menuItems = $this->menuItemRepository->getAllItemsByBlockId($item);
             foreach ($menuItems as $menuItem) {
                 $this->menuItemsModel->delete($menuItem['id']);
             }
             $menuName = $this->menuRepository->getMenuNameById($item);
             $this->cache->getCacheDriver()->delete(Cache::CACHE_ID_VISIBLE . $menuName);
         }
     }
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     $this->cache->saveCache($event->getEntryId());
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     $this->cache->saveCache($this->categoryRepository->getModuleNameFromCategoryId($event->getEntryId()));
 }
 /**
  * @param ModelSaveEvent $event
  */
 public function execute(ModelSaveEvent $event)
 {
     $data = $event->getData();
     $this->cache->saveCache($data['gallery_id']);
 }