コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function save($family, array $options = [])
 {
     if (!$family instanceof FamilyInterface) {
         throw new \InvalidArgumentException(sprintf('Expects a "Pim\\Bundle\\CatalogBundle\\Model\\FamilyInterface", "%s" provided.', ClassUtils::getClass($family)));
     }
     $options = $this->optionsResolver->resolveSaveOptions($options);
     $this->objectManager->persist($family);
     if (true === $options['flush']) {
         $this->objectManager->flush();
     }
     if (true === $options['schedule']) {
         $this->completenessManager->scheduleForFamily($family);
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function save($family, array $options = [])
 {
     if (!$family instanceof FamilyInterface) {
         throw new \InvalidArgumentException(sprintf('Expects a "Pim\\Component\\Catalog\\Model\\FamilyInterface", "%s" provided.', ClassUtils::getClass($family)));
     }
     $this->eventDispatcher->dispatch(StorageEvents::PRE_SAVE, new GenericEvent($family));
     $options = $this->optionsResolver->resolveSaveOptions($options);
     $this->objectManager->persist($family);
     if (true === $options['flush']) {
         $this->objectManager->flush();
     }
     if (true === $options['schedule']) {
         $this->completenessManager->scheduleForFamily($family);
     }
     $this->eventDispatcher->dispatch(StorageEvents::POST_SAVE, new GenericEvent($family));
 }
コード例 #3
0
 /**
  * Call when form is valid
  *
  * @param Family $family
  */
 protected function onSuccess(Family $family)
 {
     $this->manager->persist($family);
     $this->completenessManager->scheduleForFamily($family);
     $this->manager->flush();
 }