function erase() { $this->query = array_slice($this->query, 0, $this->ptr, TRUE) + array_slice($this->query, $this->ptr, NULL, TRUE); $this->skip(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); } }