本文整理汇总了PHP中KDatabaseTableDefault::select方法的典型用法代码示例。如果您正苦于以下问题:PHP KDatabaseTableDefault::select方法的具体用法?PHP KDatabaseTableDefault::select怎么用?PHP KDatabaseTableDefault::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDatabaseTableDefault
的用法示例。
在下文中一共展示了KDatabaseTableDefault::select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _deleteRevisions
/**
* 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();
}
示例2: select
/**
* 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;
}