PHP MVC - Model needs to access data from another model

Viewed 1067

I have built a small PHP MVC framework and just want to clarify the best way to get data from one model into another. For example:

I have a Users_model that contains a method called get_users().

I also have Communications_model that needs to get specific or all user data and as such needs to access the get_users() method from the Users_model.

Is it best practice to:

a) Instantiate the Users_model in a controller and pass the data from the get_users() method into the Communications_model?

b) Instantiate the Users_model inside the Communications_model and run get_users() from there, so it can be accessed directly?

c) Another way?

Many thanks for any help.

4 Answers
Related