/** * @param CustomerInterface $entity * @param array $arguments * @return CustomerInterface * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute($entity, $arguments = []) { $extensionAttribute = $entity->getExtensionAttributes()->getExtensionAttribute(); $extensionAttribute->setCustomerId($entity->getId()); $extensionAttribute = $this->entityManager->save($extensionAttribute); $entity->getExtensionAttributes()->setExtensionAttribute($extensionAttribute); return $entity; }
/** * @param CustomerInterface $entity * @param array $arguments * @return CustomerInterface * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute($entity, $arguments = []) { $newAddresses = []; foreach ($entity->getAddresses() as $address) { $address->setCustomerId($entity->getId()); $newAddresses[] = $this->entityManager->save($address); } $entity->setAddresses($newAddresses); return $entity; }
/** * @inheritDoc */ public function save(AbstractModel $object) { if ($object->isDeleted()) { return $this->delete($object); } $this->beginTransaction(); try { if (!$this->isModified($object)) { $this->processNotModifiedSave($object); $this->commit(); $object->setHasDataChanges(false); return $this; } $object->validateBeforeSave(); $object->beforeSave(); if ($object->isSaveAllowed()) { $this->_serializeFields($object); $this->_beforeSave($object); $this->_checkUnique($object); $this->objectRelationProcessor->validateDataIntegrity($this->getMainTable(), $object->getData()); $this->entityManager->save(PageInterface::class, $object); $this->unserializeFields($object); $this->processAfterSaves($object); } $this->addCommitCallback([$object, 'afterCommitCallback'])->commit(); $object->setHasDataChanges(false); } catch (\Exception $e) { $this->rollBack(); $object->setHasDataChanges(true); throw $e; } return $this; }
/** * @param AbstractModel $object * @return $this * @throws \Exception */ public function save(AbstractModel $object) { $this->entityManager->save($object); return $this; }
/** * @param AbstractModel $object * @return $this * @throws \Exception */ public function save(\Magento\Framework\Model\AbstractModel $object) { $this->entityManager->save($object, \Magento\CatalogRule\Api\Data\RuleInterface::class); return $this; }
/** * @param AbstractModel $object * @return $this * @throws \Exception */ public function save(AbstractModel $object) { $this->entityManager->save($object, BlockInterface::class, []); return $this; }
/** * {@inheritdoc} */ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer) { return $this->entityManager->save($customer); }