I am using CodeIginter as my PHP framework. I am explaining the situation below: -
I need three models named: -
- User_Model
- Relation_Model
- Reminder_Model
Now consider the situation:
User_Model is already written. I am writing Relation_Model. My friend will write the Reminder_Model.
Relation_Model instantiates User_Model, and uses that, in one of its method: getRelation($userID)
Reminder_Model also instantiates one User_Model instance for its functioning.
Reminder_Model needs to call getRelation method of Relation_Model.
So, there should be at least two instances of User_Model. One in Relation_Model, another in Reminder_Model.
The problem is how do I ensure inside Relation_Model, that my User_Model instance does not interfere with the User_Model instance of my friend’s Reminder_Model class?
That is, to code Reminder_Model, my friend should not have internal knowledge of Relation_Model, just to use one of its method getRelation.
If you want to know the need for this, say: Reminder_Model loads the model of the user who has logged in (say user-A), Relation_Model works with the models of the users who are member of user-A's team.