Skip to main content
Version: Fegg 5.x (next)

Model::reset

Reset Model

Description​

public self Model::reset()

Forgets the conditions set with the chain methods: where, having, order, join, group, select, listMax, current and limit. The model does this by itself after every query, failed ones included, so call it only to drop a chain you built but did not run. The table, primary key, visible flag, bind types and the pager are kept.

Example​

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

$model->where('category = ?', 1)->order('post_date', 'desc');

// Changed our mind: start again
$model->reset();

// Select * From "cms_news" Where 1 = 1 And "cms_news".valid = 1
$records = $model->all();