Share the module data between different modules

Hi, all

I followed the article which introduce the 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?

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.

Sorry, we have A, B modules

A module’s controller wants to invoke B module’s model

Is it possible.

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.

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. ;)