本文整理汇总了PHP中F0FTable::onAfterDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FTable::onAfterDelete方法的具体用法?PHP F0FTable::onAfterDelete怎么用?PHP F0FTable::onAfterDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FTable
的用法示例。
在下文中一共展示了F0FTable::onAfterDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterDelete
protected function onAfterDelete($oid)
{
$result = parent::onAfterDelete($oid);
if ($result) {
$result = $this->deleteScanResults($oid);
}
return $result;
}
示例2: onAfterDelete
protected function onAfterDelete($oid)
{
$db = $this->getDbo();
$myLeft = $this->lft;
$myRight = $this->rgt;
$fldLft = $db->qn($this->getColumnAlias('lft'));
$fldRgt = $db->qn($this->getColumnAlias('rgt'));
// Move all siblings to the left
$width = $this->rgt - $this->lft + 1;
// Wrap everything in a transaction
$db->transactionStart();
try {
// Shrink lft values
$query = $db->getQuery(true)->update($db->qn($this->getTableName()))->set($fldLft . ' = ' . $fldLft . ' - ' . $width)->where($fldLft . ' > ' . $db->q($myLeft));
$db->setQuery($query)->execute();
// Shrink rgt values
$query = $db->getQuery(true)->update($db->qn($this->getTableName()))->set($fldRgt . ' = ' . $fldRgt . ' - ' . $width)->where($fldRgt . ' > ' . $db->q($myRight));
$db->setQuery($query)->execute();
// Commit the transaction
$db->transactionCommit();
} catch (\Exception $e) {
// Roll back the transaction on error
$db->transactionRollback();
throw $e;
}
return parent::onAfterDelete($oid);
}