The best for create properties in model ?




public function actionAdmin()

{

	$model=new Category('search');

	$model->unsetAttributes();  // clear any default values

	if(isset($_GET['Category']))

        {

            $model->attributes=$_GET['Category']; // I think... the attributes ... it means ... the properties ?

            $model->parentIds = $_GET['Category']['parentIds']; // I dont want give value here (*)

        }

	$this->render('admin',array(

		'model'=>$model,

	));

}

In Model:




class Category extends CActiveRecord

{

    public $parentIds;

    

    public function search()

    {

	$criteria=new CDbCriteria;

	$criteria->compare('id',$this->id);

	$criteria->compare('name',$this->name,true);

        $criteria->compare('cats.pid',$this->parentIds); // It will not work if I remove (*)

        $criteria->with=array('cats');

        $criteria->together = true;


	return new CActiveDataProvider($this, array(

		'criteria'=>$criteria,

	));

    }

}



How to I can remove (*) and code still work ?

I find solution at http://www.mrsoundless.com/post/2011/05/09/Searching-and-sorting-a-column-from-a-related-table-in-a-CGridView.aspx