in model, the search() method use a $model ($this) as a filter for search. Here is the place search result returns. And the $model is posted from the _search or Objectsearch view file.
the problem is the dataProvider, remove the ‘all’, in search().
maybe you had better chage your dataProvider like this:
‘dataProvider’=>$model->search(), //why you use the active()?
what is posted: the $model is posted, to the form action , that is ‘index.php/admin/ObjectSearch’ as your code.
where the search result returns: the form action is a yii route, which means the actionObjectSearch in adminController is called.
so just take a look at what is going on in that action. it probably renders the mySearchFormView and pass the $model into it. Since you didn’t provide the code of this action, i said ‘probably’.
then take a look at mySearchFormView.php to see what is going on next. we can see that is reanders the _search view file and pass a $model into it. also it use a widget to show the search result. the search result is provided by a dataProvider. that is $model->search()
so we take a look at the model file to read search() method. we can find that the search() method use $this (the model itself) as a filter to search. so here is the place search result returns.
Where can I find the documentation on the search? What’s the difference between:
$model->active()->search('all')
,
$model->active()->search()
and
$model->search()
?
Removing the ‘active()’ has allowed one of the search filters to work a little better… So one criteria is searching, but seems to be only ever returning 10 rows. The other search criteria, if set, never returns anything.
This is despite pagination being set to false - where can I specify all rows to be returned?:
the $model->search() is generated by Gii, as a result, there is no documentation for it. Luckly, there is only several lines of code in it. and very easy to understand.
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('name',$this->name,true);
$criteria->compare('user_id',Yii::app()->user->id);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
BESIDES, i CAN’T find the documentation for $model()->active() either. Could you please provide it for me. Thanks.