Пример #1
0
 /**
  * Performed before data is saved
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 public function beforeSave($object)
 {
     if ($object->getShipment()) {
         $object->setParentId($object->getShipment()->getId());
     }
     return parent::beforeSave($object);
 }
Пример #2
0
 /**
  * Method is invoked before save
  *
  * @param \Magento\Framework\Object $object
  * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
  */
 public function beforeSave($object)
 {
     if ($object->getCreditmemo()) {
         $object->setParentId($object->getCreditmemo()->getId());
     }
     return parent::beforeSave($object);
 }
Пример #3
0
 /**
  * Perform operation before save
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 public function beforeSave($object)
 {
     if ($object->getOrder()) {
         $object->setParentId($object->getOrder()->getId());
     }
     parent::beforeSave($object);
     return $this;
 }
Пример #4
0
 /**
  * Set store id to the attribute
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 public function beforeSave($object)
 {
     if ($object->getAddress()) {
         $object->setParentId($object->getAddress()->getId())->setStoreId($object->getAddress()->getStoreId());
     }
     parent::beforeSave($object);
     return $this;
 }
Пример #5
0
 /**
  * Prepare category parentId
  *
  * @param \Magento\Framework\Object $category
  * @return $this
  */
 protected function _prepareCategoryParentId(\Magento\Framework\Object $category)
 {
     if ($category->getPath() != $category->getId()) {
         $split = explode('/', $category->getPath());
         $category->setParentId($split[count($split) - 2]);
     } else {
         $category->setParentId(0);
     }
     return $this;
 }