本文整理汇总了PHP中F0FTable::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FTable::delete方法的具体用法?PHP F0FTable::delete怎么用?PHP F0FTable::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FTable
的用法示例。
在下文中一共展示了F0FTable::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($oid = null)
{
$joins = array(array('label' => 'subscriptions', 'name' => '#__akeebasubs_subscriptions', 'idfield' => 'akeebasubs_upgrade_id', 'joinfield' => 'akeebasubs_upgrade_id', 'idalias' => 'upgradeid'));
if ($this->canDelete($oid, $joins)) {
return parent::delete($oid);
} else {
return false;
}
}
示例2: delete
/**
* Method to delete product optionvalues when product option is deleted
* (non-PHPdoc)
* @see F0FTable::delete()
* @result boolean
*/
public function delete($oid = null)
{
$status = true;
//get all the children of product options
$productoptions = F0FModel::getTmpInstance('Productoptionvalues', 'J2StoreModel')->productoption_id($oid)->getList();
if (isset($productoptions) && !empty($productoptions)) {
//loop the productoptions to load and delete the
foreach ($productoptions as $poption) {
$productoption = F0FTable::getAnInstance('Productoptionvalue', 'J2StoreTable');
$productoption->load($poption->j2store_product_optionvalue_id);
if (!$productoption->delete($poption->j2store_product_optionvalue_id)) {
$status = false;
}
}
}
$status = parent::delete($oid);
return $status;
}
示例3: delete
/**
* Delete a node, either the currently loaded one or the one specified in $id. If an $id is specified that node
* is loaded before trying to delete it. In the end the data model is reset. If the node has any children nodes
* they will be removed before the node itself is deleted if $recursive == true (default: true).
*
* @param integer $oid The primary key value of the item to delete
* @param bool $recursive Should I recursively delete any nodes in the subtree? (default: true)
*
* @throws UnexpectedValueException
*
* @return boolean True on success
*/
public function delete($oid = null, $recursive = true)
{
// Load the specified record (if necessary)
if (!empty($oid)) {
$this->load($oid);
}
// Recursively delete all children nodes as long as we are not a leaf node and $recursive is enabled
if ($recursive && !$this->isLeaf()) {
// Get a reference to the database
$db = $this->getDbo();
// Get my lft/rgt values
$myLeft = $this->lft;
$myRight = $this->rgt;
$fldLft = $db->qn($this->getColumnAlias('lft'));
$fldRgt = $db->qn($this->getColumnAlias('rgt'));
// Get all sub-nodes
$table = $this->getClone();
$table->reset();
$subNodes = $table->whereRaw($fldLft . ' > ' . $myLeft)->whereRaw($fldRgt . ' < ' . $myRight)->get();
// Delete all subnodes (goes through the model to trigger the observers)
if (!empty($subNodes)) {
/** @var F0FTableNested $item */
foreach ($subNodes as $item) {
$item->delete(null, false);
}
}
}
return parent::delete($oid);
}