本文整理汇总了PHP中Magento\Framework\Model\Resource\Db\AbstractDb::_beforeDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractDb::_beforeDelete方法的具体用法?PHP AbstractDb::_beforeDelete怎么用?PHP AbstractDb::_beforeDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\Resource\Db\AbstractDb
的用法示例。
在下文中一共展示了AbstractDb::_beforeDelete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeDelete
/**
* Check if group uses as default
*
* @param \Magento\Framework\Model\AbstractModel $group
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $group)
{
if ($group->usesAsDefault()) {
throw new \Magento\Framework\Exception\LocalizedException(__('You can\'t delete group "%1".', $group->getCode()));
}
return parent::_beforeDelete($group);
}
示例2: _beforeDelete
/**
* Check if group uses as default
*
* @param \Magento\Framework\Model\AbstractModel $group
* @return $this
* @throws \Magento\Framework\Model\Exception
*/
protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $group)
{
if ($group->usesAsDefault()) {
throw new \Magento\Framework\Model\Exception(__('The group "%1" cannot be deleted', $group->getCode()));
}
return parent::_beforeDelete($group);
}
示例3: _beforeDelete
/**
* Process page data before deleting
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
{
$condition = array('page_id = ?' => (int) $object->getId());
$this->_getWriteAdapter()->delete($this->getTable('cms_page_store'), $condition);
return parent::_beforeDelete($object);
}
示例4: _beforeDelete
/**
* Perform actions before object delete
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
* @throws \Magento\Framework\Exception\StateException
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
{
/** @var \Magento\Eav\Api\Data\AttributeSetInterface $object */
$defaultAttributeSetId = $this->eavConfig->getEntityType($object->getEntityTypeId())->getDefaultAttributeSetId();
if ($object->getAttributeSetId() == $defaultAttributeSetId) {
throw new \Magento\Framework\Exception\StateException(__('Default attribute set can not be deleted'));
}
return parent::_beforeDelete($object);
}
示例5: _beforeDelete
/**
* Process author data before deleting
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _beforeDelete(AbstractModel $object)
{
$condition = ['author_id = ?' => (int) $object->getId()];
$this->_getWriteAdapter()->delete($this->getTable('sample_news_author_store'), $condition);
return parent::_beforeDelete($object);
}
示例6: _beforeDelete
/**
* Process brand data before deleting
*
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
{
$condition = ['brand_id = ?' => (int) $object->getId()];
$this->getConnection()->delete($this->getTable('ves_brand_store'), $condition);
return parent::_beforeDelete($object);
}