About design patterns?

Hello everybody.

I am here to take advices about how could I play with SEARCH in a way that doesn’t complex my code.

I refer to search when a user has a form with search button and makes a request to controller.

How do you guys deal with it?

Do you implement algorithm in model ?

Somebody makes use of Patterns in this scenario ?

Have you had a look at the CRUD code generated by Yii 1.1.1? It now generates some search code in the model and the admin view. This might be worth a look.

If I have complex searches for a particular model I tend to create a new class (eg QuestionSearch), in this class I have all the search criteria as properties, and I generate the criteria required for the search. I also use the same class to make a textual description of the search (eg. searched for all questions by John with the Swimming tag).

It was about “supertype” or something like that I was asking about :D Thank you for your answer! :)