本文整理汇总了PHP中Magento\Framework\DataObject::setParentId方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::setParentId方法的具体用法?PHP DataObject::setParentId怎么用?PHP DataObject::setParentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\DataObject
的用法示例。
在下文中一共展示了DataObject::setParentId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeSave
/**
* Method is invoked before save
*
* @param \Magento\Framework\DataObject $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);
}
示例2: beforeSave
/**
* Performed before data is saved
*
* @param \Magento\Framework\DataObject $object
* @return $this
*/
public function beforeSave($object)
{
if ($object->getShipment()) {
$object->setParentId($object->getShipment()->getId());
}
return parent::beforeSave($object);
}
示例3: beforeSave
/**
* Perform operation before save
*
* @param \Magento\Framework\DataObject $object
* @return $this
*/
public function beforeSave($object)
{
if ($object->getOrder()) {
$object->setParentId($object->getOrder()->getId());
}
parent::beforeSave($object);
return $this;
}
示例4: beforeSave
/**
* Set store id to the attribute
*
* @param \Magento\Framework\DataObject $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: _prepareCategoryParentId
/**
* Prepare category parentId
*
* @param \Magento\Framework\DataObject $category
* @return $this
*/
protected function _prepareCategoryParentId(\Magento\Framework\DataObject $category)
{
if ($category->getPath() != $category->getId()) {
$split = explode('/', $category->getPath());
$category->setParentId($split[count($split) - 2]);
} else {
$category->setParentId(0);
}
return $this;
}