本文整理汇总了PHP中Magento\Framework\Model\AbstractModel::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractModel::delete方法的具体用法?PHP AbstractModel::delete怎么用?PHP AbstractModel::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\AbstractModel
的用法示例。
在下文中一共展示了AbstractModel::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _testDelete
protected function _testDelete()
{
$modelId = $this->_model->getId();
$this->_model->delete();
$model = $this->_getEmptyModel();
$model->load($modelId);
\PHPUnit_Framework_Assert::assertEmpty($model->getId(), 'CRUD Delete error');
}
示例2: delete
/**
* @return bool
* @throws \Ess\M2ePro\Model\Exception\Logic
*/
public function delete()
{
if (is_null($this->getId())) {
throw new \Ess\M2ePro\Model\Exception\Logic('Method require loaded instance first');
}
if ($this->isLocked()) {
return false;
}
if ($this->isCacheEnabled()) {
$this->getHelper('Data\\Cache\\Permanent')->removeTagValues($this->getCacheInstancesTag());
}
//TODO delete processing locks with sql
$this->deleteProcessingLocks();
return parent::delete();
}
示例3: _undo
/**
* Delete model
*
* @param \Magento\Framework\Model\AbstractModel $duplicate
*/
protected function _undo($duplicate)
{
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Store\\Model\\StoreManagerInterface')->getStore()->setId(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
$duplicate->delete();
}
示例4: callModelDelete
/**
* Call safe delete for model
*
* @param \Magento\Framework\Model\AbstractModel $model
* @param bool $secure
* @return \Magento\TestFramework\TestCase\WebapiAbstract
*/
public static function callModelDelete($model, $secure = false)
{
if ($model instanceof \Magento\Framework\Model\AbstractModel && $model->getId()) {
if ($secure) {
self::_enableSecureArea();
}
$model->delete();
if ($secure) {
self::_enableSecureArea(false);
}
}
}