/**
  * @param GenericEvent $event
  */
 public function updateChannel(GenericEvent $event)
 {
     $channel = $event->getSubject();
     if (!$channel instanceof ChannelInterface) {
         return;
     }
     $oldLocales = $this->repository->getDeletedLocalesForChannel($channel);
     $newLocales = $channel->getLocales();
     $updatedLocales = [];
     foreach ($oldLocales as $locale) {
         $locale->removeChannel($channel);
         $updatedLocales[] = $locale;
         if (null !== $this->completeness) {
             $this->completeness->scheduleForChannelAndLocale($channel, $locale);
         }
     }
     foreach ($newLocales as $locale) {
         if (!$locale->hasChannel($channel)) {
             $locale->addChannel($channel);
             $updatedLocales[] = $locale;
         }
     }
     if (!empty($updatedLocales)) {
         $this->saver->saveAll($updatedLocales);
     }
 }
 /**
  * Schedule recalculation of completenesses for all products
  * of a channel
  *
  * @param ChannelInterface $channel
  */
 public function scheduleForChannel(ChannelInterface $channel)
 {
     if ($channel->getId()) {
         $deletedLocaleIds = $this->channelRepository->getDeletedLocaleIdsForChannel($channel);
         foreach ($deletedLocaleIds as $deletedLocaleId) {
             $deletedLocale = $this->localeRepository->find($deletedLocaleId);
             $this->generator->scheduleForChannelAndLocale($channel, $deletedLocale);
         }
     }
 }
 /**
  * Schedule recalculation of completenesses for all product
  * of a family
  *
  * @param FamilyInterface $family
  */
 public function scheduleForFamily(FamilyInterface $family)
 {
     if ($family->getId()) {
         $this->generator->scheduleForFamily($family);
     }
 }