T
T
thorii2016-11-03 17:25:55
Yii
thorii, 2016-11-03 17:25:55

So what are the pitfalls of the Yii2 architecture?

I read holivars on the topic Yii vs Phalcon. I was interested in one nuance about DI containers.
In Yii, this is In the falcon, it is necessary to pass and receive the container through setters In your opinion? What is the downside of the yii2 approach? I read criticism in his direction, in particular to his container yii::$app->service //доступно везде и всегда

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
index0h, 2016-11-04
@thorii

What is the downside of the yii2 approach?

At any point in your code, you can safely bend your entire project, given that $app is a public static variable. In fact, this is not much different from a global variable, albeit in a separate namespace.
You can change anything at runtime simply because you have access. Such freedom for large projects is a wildly dangerous practice.

D
dmitriy, 2016-11-03
@dmitriylanets

pros: 1. lazy loading of dependencies 2. testability
cons: 1. lack of a contract between classes 2. Makes the appearance of a good class design (Undefined class complexity) 3. DI option in YII still being a singleton violates the multi-layer system

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question