Cml\Model::getListByPaginate PHP Метод

getListByPaginate() публичный Метод

以分页的方式获取数据列表
public getListByPaginate ( integer $limit = 20, string | array $order = 'DESC', string $tableName = null, mixed $tablePrefix = null ) : array
$limit integer 每页返回的条数
$order string | array 传asc 或 desc 自动取主键 或 ['id'=>'desc', 'status' => 'asc']
$tableName string 表名 不传会自动从当前Model中$table属性获取
$tablePrefix mixed 表前缀 不传会自动从当前Model中$tablePrefix属性获取再没有则获取配置中配置的前缀
Результат array
    public function getListByPaginate($limit = 20, $order = 'DESC', $tableName = null, $tablePrefix = null)
    {
        is_null($tableName) && ($tableName = $this->getTableName());
        is_null($tablePrefix) && ($tablePrefix = $this->tablePrefix);
        is_array($order) || ($order = [$this->db($this->getDbConf())->getPk($tableName, $tablePrefix) => $order]);
        $dbInstance = $this->db($this->getDbConf())->table($tableName, $tablePrefix);
        foreach ($order as $key => $val) {
            $dbInstance->orderBy($key, $val);
        }
        return $dbInstance->paginate($limit);
    }