dubby
(Damien)
1
In the Business model on the project I’m working on, I want to be able to add a criteria of status=1 when a link is clicked on:
'url'=>array('admin', 'status'=>1)
In the controller, the method actionAdmin() instantiates the model with $model=new Business(‘search’);
How do I modify the search results here? Can someone point me to where I can read about this? My searches so far have me lost.
rootbear
(Alex Xm)
2
try this, in your control:
public function actionAdmin($status = null) {
//$model = new Business('search');
$model = new Business;
$model->unsetAttributes();
if (isset($_GET['Business']))
$model->setAttributes($_GET['Business']);
if ($status) //<--added
$model->status = $status;
$this->render('admin', array(
'model' => $model,
));
}
dubby
(Damien)
3
Interesting. I would not have guessed that but it worked.
Thanks rootbear.