module property to Component class
Posted 10 March 2012 - 02:32 AM
Also: What about having a central topic for small things, like this one?
Posted 10 March 2012 - 01:17 PM
Since a module is an application inside an application, any component (extends CComponent) can reside in a module.
The proposal is to have a getModule method in the new Component class (which will replace the current CComponent class).
This will help make modules more pluggable/reusable when module's components need to reference its parent module.
A lesser alternative to having getModule in Component is to have it in BaseController or to add it to Widget.
Posted 12 March 2012 - 10:26 AM
Posted 12 March 2012 - 03:42 PM
I was thinking about it while writing the original post. I don't have the answer, but this may be easier the way Yii 2.0 is being designed (which I don't know) or if considered early enough, can be part of the design itself.
Posted 12 March 2012 - 06:11 PM
When the idea came, it was to have the method return the module the component (a widget in this case) belongs to, not the module that's using the component. But it might just fit one use case and not fit other ones.