当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractDb::_beforeDelete方法代码示例

本文整理汇总了PHP中Magento\Framework\Model\ResourceModel\Db\AbstractDb::_beforeDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractDb::_beforeDelete方法的具体用法?PHP AbstractDb::_beforeDelete怎么用?PHP AbstractDb::_beforeDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Model\ResourceModel\Db\AbstractDb的用法示例。


在下文中一共展示了AbstractDb::_beforeDelete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _beforeDelete

 /**
  * Process category data before deleting
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
 {
     $condition = ['category_id = ?' => (int) $object->getId()];
     $this->getConnection()->delete($this->getTable('magefan_blog_category_store'), $condition);
     $this->getConnection()->delete($this->getTable('magefan_blog_post_category'), $condition);
     return parent::_beforeDelete($object);
 }
开发者ID:samitrimal,项目名称:Blog-Extension-for-Magento-2,代码行数:13,代码来源:Category.php

示例2: _beforeDelete

 /**
  * Process page data before deleting
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
 {
     $condition = ['slider_id = ?' => (int) $object->getId()];
     $this->getConnection()->delete($this->getTable('magebase_carousel_join'), $condition);
     $this->getConnection()->delete($this->getTable('slider_store_join'), $condition);
     return parent::_beforeDelete($object);
 }
开发者ID:igor-lero9,项目名称:magebase_carousel,代码行数:13,代码来源:Slider.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 = ['page_id = ?' => (int)$object->getId()];

        $this->getConnection()->delete($this->getTable('cms_page_store'), $condition);

        return parent::_beforeDelete($object);
    }
开发者ID:razbakov,项目名称:magento2,代码行数:14,代码来源:Page.php

示例4: _beforeDelete

 /**
  * Process post data before deleting
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
 {
     $condition = ['post_id = ?' => (int) $object->getId()];
     $tableSufixs = ['store', 'category', 'tag', 'relatedproduct', 'relatedpost', 'relatedpost'];
     foreach ($tableSufixs as $sufix) {
         $this->getConnection()->delete($this->getTable('magefan_blog_post_' . $sufix), $sufix == 'relatedpost' ? ['related_id = ?' => (int) $object->getId()] : $condition);
     }
     return parent::_beforeDelete($object);
 }
开发者ID:magefan,项目名称:module-blog,代码行数:15,代码来源:Post.php

示例5: _beforeDelete

 /**
  * Process download data before deleting
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  *
  * @return $this
  */
 protected function _beforeDelete(AbstractModel $object)
 {
     $condition = ['download_id = ?' => (int) $object->getId()];
     $this->getConnection()->delete($this->getTable('sebwite_product_downloads'), $condition);
     return parent::_beforeDelete($object);
 }
开发者ID:BlackIkeEagle,项目名称:Magento2-Product-Downloads,代码行数:13,代码来源:Download.php

示例6: _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->getConnection()->delete($this->getTable('sample_news_author_store'), $condition);
     return parent::_beforeDelete($object);
 }
开发者ID:sz-bill,项目名称:Magento2.x,代码行数:12,代码来源:Author.php

示例7: _beforeDelete

 /**
  * Process page data before deleting
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
 {
     $condition = ['form_id = ?' => (int) $object->getId()];
     $this->getConnection()->delete($this->getTable(self::STORE_TABLE_NAME), $condition);
     return parent::_beforeDelete($object);
 }
开发者ID:AddictedToMagento,项目名称:dynamic-forms,代码行数:12,代码来源:Form.php

示例8: _beforeDelete

 /**
  * @param AbstractModel $object
  * @return $this
  */
 protected function _beforeDelete(\Magento\Framework\Model\AbstractModel $object)
 {
     parent::_beforeDelete($object);
     /**
      * Update children count for all parent Categories
      */
     $parentIds = $object->getParentIds();
     if ($parentIds) {
         $childDecrease = $object->getChildrenCount() + 1;
         // +1 is itself
         $data = ['children_count' => new \Zend_Db_Expr('children_count - ' . $childDecrease)];
         $where = ['category_id IN(?)' => $parentIds];
         $this->getConnection()->update($this->getMainTable(), $data, $where);
     }
     $this->deleteChildren($object);
     return $this;
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:21,代码来源:Category.php

示例9: _beforeDelete

 /**
  * Process article data before deleting
  *
  * @param \Magento\Framework\Model\AbstractModel $object
  * @return $this
  */
 protected function _beforeDelete(AbstractModel $object)
 {
     $condition = ['article_id = ?' => (int) $object->getId()];
     $this->getConnection()->delete($this->getTable('gemtoo_blog_article_store'), $condition);
     return parent::_beforeDelete($object);
 }
开发者ID:pleminh,项目名称:Gemtoo,代码行数:12,代码来源:Article.php

示例10: _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:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:Set.php


注:本文中的Magento\Framework\Model\ResourceModel\Db\AbstractDb::_beforeDelete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。