Yii Framework Forum

design pattern used in yii framework


(Juvenalcr) #1

Hi everybody i would like to know which one design pattern was used in yii framework, I know the design pattern have 3 part: the design pattern of creational(singleton, abstract fractory, factory method, builder, prototype), the design pattern of structural(Adapter, bridge, composite, decorator, facade, flyweight and proxy) and the design pattern of behavior(interpreter template method, chain of responsibility, command, iterator, mediator, memento, observer, state, strategy, visitor).

i know was used singleton, activeRecord but would like to know if there are other design pattern.


(Alexander Makarov) #2

Abstract Factory, Factory Method, Builder, Adapter, Composite, Decorator, Facade, Proxy, Flyweight, Chain of responsibility, Command, Iterator, Observer, State, Strategy, Template method, Dependency Injection, Repository, mixin etc.


(Wolfling) #3

Hi, Alex. Thx a lot for your answer. Could you specify please, where exactly does Yii use these bunch of patterns? For instance, Doctrine provides the list of specific use-cases: docs.doctrine-project.org / projects / doctrine1 / en / latest / en / manual / technology.html#design-patterns-used

Are ‘beforeAction’ and ‘afterAction’ implementation of template method?

Where is the Factory Method used?

Proxy? Decorator?

Thx a lot in advance.

Looking forward to your prompt response.


(Alexander Makarov) #4

Well, that’s nearly everywhere. Won’t provide a list, don’t have enough time to compile it right now.