luffy
(Kingla Pei)
September 5, 2011, 3:49am
1
Hi, all
I followed the article which introduce the module
http://www.yiiframework.com/doc/guide/1.1/en/basics.module
The forums module and blog module, user module will have the same user data and some same user methods.
How to share the same user data between different modules?
mukeshsoni
(Mukeshsoni)
September 5, 2011, 6:53am
2
in MVC framework, you access data through the models… and modules consist of controllers and views…
so sharing data across modules just means creating an instance of the User model in whichever module you need it. You should try and read upon MVC framework to get the basics.
luffy
(Kingla Pei)
September 5, 2011, 1:18pm
3
Sorry, we have A, B modules
A module’s controller wants to invoke B module’s model
Is it possible.
genn
(Ch Velkov)
September 5, 2011, 1:30pm
4
Yes, it is possible.
Just import the models directory of the module.
If your model has any module-specific dependencies, you have to import them too.
jacmoe
(Jacob Moen)
September 5, 2011, 2:19pm
5
Think about it:
The db tables are available to you from anywhere within your application.
If you want to use the module models with it, import as mentioned above. Otherwise, just connect and query.