Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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);
 }