mardi 10 mars 2015

mvc php: using model inside another model

I was wondering if initializing and using a model inside another model is the right way to do things in model view controller pattern. Should a model be completely encapsulated from outside and be unaware of other models?


For example, would it be bad if a registration model uses a user model to see if a user already exists with a given username? If not, what is the best way to do this? initializing the user model inside the registration model directly or passing the user model to the registration model as a parameter from the controller? I would also like to hear if there is a third (better) way.


Aucun commentaire:

Enregistrer un commentaire