Yii Search Module

Hello All,

Just started working on Yii, finds to good…

I have one problem, for which i m searching for last 2 days,

Here is my issue…

I have to achieve 1 functionality of search for the leaves…

I have models for my entities like, employee, department, leaves.

but for the search, i have to use them all together.

So here is my 1st question, can i do it?

like create 1 model for search and in that use all the models over that, does it sounds good?

First of all welcome to the yii forum :D

to get better help please check the forum posting guidelines - http://www.yiiframework.com/forum/index.php?/topic/19451-guidelines-for-posting-this-forum/

As for the search from your question it’s not clear where and how the search will be performed… as the user of your application can be in the leaves section and then make the search or in the company section and then make the search

In the end you don’t need a model for the search - check the MVC basis - http://www.yiiframework.com/doc/guide/1.1/en/basics.mvc

one model represents one database table

So you can create a model method for the search… or for the general search you can create a widget…

I wouldn’t create a separate module for each entity, especially when they all are related, it only makes things complicated (imho). For search you need a widget and a controller. SearchModel is also a good idea if you have many search form fields and want to apply some validation rules.

Thanks for the Quick Reply from both of you.

Yes I have 6 to 7 Search Criteria, and because of that i have create diff controller, view and model for the Search. In the Search Model I m doing join… and achieve the Results. Now I have Different Issue. Please Help me on this also. As I have to finish this module ASAP.

Waiting for replys