當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractDb::_beforeDelete方法代碼示例

本文整理匯總了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);
 }
開發者ID:shazal,項目名稱:magento2,代碼行數:14,代碼來源:Group.php

示例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);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:14,代碼來源:Group.php

示例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);
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:12,代碼來源:Page.php

示例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);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:Set.php

示例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);
 }
開發者ID:nhc,項目名稱:Magento2SampleModule,代碼行數:12,代碼來源:Author.php

示例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);
 }
開發者ID:vasuscoin,項目名稱:brand,代碼行數:12,代碼來源:Brand.php


注:本文中的Magento\Framework\Model\Resource\Db\AbstractDb::_beforeDelete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。