/** * Delete one or all revisions for a row * * @param string The row status to look for * @return boolean */ protected function _deleteRevisions($status = null) { $query = array('table' => $this->getTable()->getName(), 'row' => $this->id); if ($status) { $query['status'] = $status; } return $this->_table->select($query)->delete(); }
/** * Table select method * * The name of the resulting row(set) class is based on the table class name * eg <Mycomp>Table<Tablename> -> <Mycomp>Row(set)<Tablename> * * This function will return an empty rowset if called without a parameter. * * @param mixed KDatabaseQuery, query string, array of row id's, or an id or null * @param integer The database fetch mode. Default FETCH_ROWSET. * @return KDatabaseRow or KDatabaseRowset depending on the mode. By default will * return a KDatabaseRowset */ public function select($query = null, $mode = KDatabase::FETCH_ROWSET) { $result = parent::select($query, $mode); if ($mode === KDatabase::FETCH_FIELD) { return $result; } if (is_a($result, 'KDatabaseRowInterface')) { $result = array($result); } foreach ($result as $row) { $params = json_decode($row->params, true); if (!is_array($params)) { $params = array(); } $defaults = $this->_getDefaultsFromXML($row); $params = new KConfig($params); $params->append($defaults); $row->params = $params; } return is_array($result) ? $result[0] : $result; }