DB\Cursor::erase PHP Method

erase() public method

Delete current record
public erase ( ) : integer | boolean
return integer | boolean
    function erase()
    {
        $this->query = array_slice($this->query, 0, $this->ptr, TRUE) + array_slice($this->query, $this->ptr, NULL, TRUE);
        $this->skip(0);
    }

Usage Example

Beispiel #1
0
 /**
  * Delete object/s and reset ORM
  * @param $filter
  * @return void
  */
 public function erase($filter = null)
 {
     $filter = $this->queryParser->prepareFilter($filter, $this->dbsType);
     if (!$filter && $this->emit('beforeerase') !== false) {
         if ($this->fieldConf) {
             foreach ($this->fieldConf as $field => $conf) {
                 if (isset($conf['has-many']) && $conf['has-many']['hasRel'] == 'has-many') {
                     $this->set($field, null);
                 }
             }
             $this->save();
         }
         $this->mapper->erase();
         $this->emit('aftererase');
     } elseif ($filter) {
         $this->mapper->erase($filter);
     }
 }
All Usage Examples Of DB\Cursor::erase