Ejemplo n.º 1
0
 /**
  * Synchronize system banner zones.
  *
  * @param string $locale
  */
 public function synchronize($locale)
 {
     $existingSystemZones = $this->manager->findSystemSlugs();
     $newZones = array();
     foreach ($this->registry->getConfigs() as $config) {
         if (false === in_array($config->getSlug(), $existingSystemZones)) {
             $newZones[] = $this->createZone($config);
         }
     }
     if (0 < count($newZones)) {
         $this->manager->save();
         foreach ($newZones as $zone) {
             $this->eventDispatcher->dispatch(BannerZoneEvents::CREATE, new BannerZoneEvent($zone, $locale));
         }
     }
 }
Ejemplo n.º 2
0
 public function deleteAction(Request $request, $zoneId)
 {
     $bannerZone = $this->getBannerZoneOr404($zoneId);
     if ($this->deleteHandler->process($bannerZone, $request)) {
         $this->bannerZoneManager->save();
         $this->eventDispatcher->dispatch(BannerZoneEvents::DELETE, $this->createEvent($bannerZone, $request));
         return $this->deleteHandler->onSuccess();
     }
     return $this->deleteHandler->onError();
 }