本文整理汇总了PHP中ActiveRecordModel::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::delete方法的具体用法?PHP ActiveRecordModel::delete怎么用?PHP ActiveRecordModel::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecordModel
的用法示例。
在下文中一共展示了ActiveRecordModel::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete()
{
if (ActiveRecordModel::getApplication()->getConfig()->get('CLONE_STORE_TYPE') == 'CLONE_STORE_MASTER') {
return parent::delete();
} else {
ActiveRecordModel::executeUpdate('SET FOREIGN_KEY_CHECKS=0');
ActiveRecordModel::executeUpdate('UPDATE ' . __CLASS__ . ' SET productID=NULL, variationID=NULL, protectedFields="|productID||variationID|" WHERE ID=' . $this->getID());
}
}
示例2: delete
public function delete()
{
parent::delete();
$f = new ARUpdateFilter();
$f->addModifier('ratingSum', new ARExpressionHandle('ratingSum-' . $this->rating->get()));
$f->addModifier('ratingCount', new ARExpressionHandle('ratingCount-1'));
$f->addModifier('rating', new ARExpressionHandle('ratingSum/ratingCount'));
$this->updateRatings($f);
}
示例3: delete
/**
* Removes a product review from a database
*/
public function delete()
{
// reduce product review count
$this->updateProductCounter(false);
// update ratings
foreach ($this->getRelatedRecordSet('ProductRating') as $rating) {
$rating->delete();
}
return parent::delete();
}
示例4: deleteRecord
protected function deleteRecord(ActiveRecordModel $record)
{
$record->delete();
}
示例5: delete
public function delete()
{
$this->product->get()->updateCategoryCounters($this->product->get()->getCountUpdateFilter(true), $this->category->get());
parent::delete();
}
示例6: delete
public function delete()
{
parent::delete();
$this->updateConditionRecordCount(false);
}
示例7: delete
public function delete()
{
$order = $this->order->get();
$order->removeShipment($this);
parent::delete();
$order->save();
}
示例8: delete
/**
* Delete this node with subtree
*
* @return bool
*
* @throws Exception If failed to commit the transaction
*/
public function delete()
{
$className = get_class($this);
$this->load();
$t_r = $this->getFieldValue(self::RIGHT_NODE_FIELD_NAME);
$t_l = $this->getFieldValue(self::LEFT_NODE_FIELD_NAME);
$width = $this->getWidth();
ActiveRecordModel::beginTransaction();
try {
$updates[] = "UPDATE {$className} SET " . self::RIGHT_NODE_FIELD_NAME . " = " . self::RIGHT_NODE_FIELD_NAME . " - {$width} WHERE " . self::RIGHT_NODE_FIELD_NAME . " >= {$t_r}";
$updates[] = "UPDATE {$className} SET " . self::LEFT_NODE_FIELD_NAME . " = " . self::LEFT_NODE_FIELD_NAME . " - {$width} WHERE " . self::LEFT_NODE_FIELD_NAME . " >= {$t_l}";
foreach ($updates as $update) {
self::getLogger()->logQuery($update);
self::getDBConnection()->executeUpdate($update);
}
$result = parent::delete();
ActiveRecordModel::commit();
foreach (ActiveRecord::retrieveFromPool(get_class($this)) as $instance) {
if ($instance->getFieldValue(self::RIGHT_NODE_FIELD_NAME) >= $t_r) {
$instance->setFieldValue(self::RIGHT_NODE_FIELD_NAME, $instance->getFieldValue(self::RIGHT_NODE_FIELD_NAME) - $width);
}
if ($instance->getFieldValue(self::LEFT_NODE_FIELD_NAME) >= $t_l) {
$instance->setFieldValue(self::LEFT_NODE_FIELD_NAME, $instance->getFieldValue(self::LEFT_NODE_FIELD_NAME) - $width);
}
}
} catch (Exception $e) {
ActiveRecordModel::rollback();
throw $e;
}
$this->setID(false);
$this->markAsNotLoaded();
return $result;
}