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 ?
Page 1 of 1
About design patterns?
#2
Posted 25 March 2010 - 08:19 PM
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).
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).
My sites: The Big Eat and The Big Space
#3
Posted 28 March 2010 - 12:36 PM
Alex Muir, on 25 March 2010 - 08:19 PM, said:
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).
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
Share this topic:
Page 1 of 1

Help













