Hi, i would like to add search functionality with multiple models. In yii is there any extension for multiple model search? or how it possible in yii?
Thanks.
Hi, i would like to add search functionality with multiple models. In yii is there any extension for multiple model search? or how it possible in yii?
Thanks.
you can write a custom query on model search function
Not a custom query… Need entire models search functionality.
if you want to add a multiple model search functionality on just you can check the your model relation and write a query on model search function
for e.g
$criteria->compare('password', $this->password, true);
hey its for searching in one model.
Already i mentioned searching all models in the application. Not a model search.
so you can write a custom query on search function
for e.g
if (isset($this->city_id) && !empty($this->city_id)) {
$criteria = new CDbCriteria;
$criteria->select = 't.*, tu.* ';
$criteria->join = ' LEFT JOIN `city` AS `tu` ON t.city_id = tu.id';
$criteria->addCondition("city_name='" . $this->city_id . "'");
}
Sounds like you would like to search in two ore more models (tables in database)? I think your best option is searching in each of the models and combine the results.