コード例 #1
0
 /**
  * Call when form is valid
  * @param Channel $channel
  */
 protected function onSuccess(Channel $channel)
 {
     $this->manager->persist($channel);
     $this->completenessManager->scheduleForChannel($channel);
     foreach ($channel->getLocales() as $locale) {
         $this->manager->persist($locale);
     }
     $this->manager->flush();
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function save($channel, array $options = [])
 {
     if (!$channel instanceof ChannelInterface) {
         throw new \InvalidArgumentException(sprintf('Expects a "Pim\\Bundle\\CatalogBundle\\Model\\ChannelInterface", "%s" provided.', get_class($channel)));
     }
     $options = $this->optionsResolver->resolveSaveOptions($options);
     $this->objectManager->persist($channel);
     if (true === $options['schedule']) {
         $this->completenessManager->scheduleForChannel($channel);
     }
     if (true === $options['flush']) {
         $this->objectManager->flush();
     }
 }