Yii Framework Forum: About design patterns? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

About design patterns? Rate Topic: -----

#1 User is offline   AngĂ©llica Cardozo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 11-March 09

Posted 23 March 2010 - 09:20 AM

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 ?
0

#2 User is offline   Alex Muir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 96
  • Joined: 25-April 09

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).
My sites: The Big Eat and The Big Space
0

#3 User is offline   AngĂ©llica Cardozo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 11-March 09

Posted 28 March 2010 - 12:36 PM

View PostAlex 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).


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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users