Answer the question
In order to leave comments, you need to log in
How good or bad is strong coupling in Yii, and is it possible to make something similar to Service Locator for Yii?
Hello, I have a Yii question. How good or bad is strong coupling in Yii, and is it possible to make something similar to Service Locator for Yii?. Before that, I worked with Magento and really liked the ability to redefine entities for all modules of the system. Now I'm trying to implement a modular structure for Yii, put configurations into modules for ease of writing, now it's up to Service Locator. Are there ready-made solutions or concepts of solutions, and do I need it at all?) Maybe I'm looking in the wrong direction? According to my logic, the Service Locator is needed because one change for all binders is very useful.
I must say right away that I am not yet strong in Yii, so please do not kick much. Any criticism is well received. Thanks
Answer the question
In order to leave comments, you need to log in
Not a component, but for example a model for the User module, while all modules that use this model receive a new class.
SL or DiC is not suitable for Yii, the creators of the framework talked about this, including on Habré . For external logic, you can wind up something of your own.
If you're looking at DiC or SL, try Symfony2, Zend 2, Laravel 4, or something else. Yii has its own way, get used to global access.
Answering the question of the breakdown of components.
We configure in the components section and get access through Yii::app(). Everywhere.
Modules are. But they work strangely, and we did not understand each other. Try you.
So you want to redefine the component? What is the problem? Specify the required class in the config, in the components section.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question