メインコンテンツまでスキップ
Version: Fegg 5.x

Model::all

条件に合うすべての行を取得します

説明​

public array Model::all()

条件に合うすべての行を、ページングせずに返します(連想配列の配列。合う行がなければ空の配列)。行数はlimitで制限できます。一覧をページごとに表示するときはfindを使います。

例​

Controller
$model = new Model(false, array(
'table' => 'cms_news',
'id' => 'news_id',
'visible' => 'visible',
));

// Every news of category 2
$records = $model->where('category = ?', 2)->order('post_date', 'desc')->all();

// The 5 newest
$records = $model->order('post_date', 'desc')->limit(5)->all();