But they are still a list of models right? So how could I point to object has id=1 or the first model of the list?. $model->0 or must be $model->findByPk($id)?
Sorry, my mistake. Well, I dont know how this work. Why it must be :$model=new Model(‘search’) but not : $model=new Model()? Because they are the same when we send that parameters to the CGridView. They are a object without value or Null value at its attributes.
And I believe that $_GET[‘Model’] could be returned as array or single object, so “$model->attributes=$_GET[‘Model’]” will assign the attributes and create an array for this $model because php is stateless?
I’ve tried it: Use $model=new Model(); the searching function still working. But not able to search by id, other attributes run very smoothy.
It has nothing to do with state(less). Not sure what that means.
The only thing the parameter i [/i]is doing is specifying a scenario. That scenario tells Yii that attributes can be massively assigned - read about it here[size=2] &[/size][size=2] [/size]here.
The findAll and search methods return different things.
[list=1][]$model->search() returns a CActiveDataProvider[]Model::model()->findAll() returns an array of model instances.[/list]