Retrieve data in a model from another model

Hi, I have a model with searchcriterias that can be changed from an admin panel. So depending on the the values in a options-table the searchcriterias can be changed.

In other words, I need to retrieve data in a model from another model, is this possible?

I tried with this in my Person-model(search()-function):




$option = Options::model()->find(array('select'=>'option_1'));






if (empty($this->searchoption))

		{

        	$criteria->params['option_1'] = $option;

        }



but it does not work.

Is it better to send the data from the controller to the model in some way?

Ideas?

My doubt is that you are passing the whole object($option) as value to the parameter.

If I am correct, it may be like




if (empty($this->searchoption))

                {

                $criteria->params['option_1'] = $option->someAttribute;

        }




ah, stupid of me! it works now, thank you!