Welcome Guest, Not a member yet? Register   Sign In
Calling a Model from another Model
#2

[eluser]PhilTem[/eluser]
It can be done by simply addressing the model as you would do in a controller.

Code:
$this->my_other_model->one_method(); // Put this in any method of your first model

However, it is not best practice, since each model should only have knowledge about its corresponding table and not about anything else (that's why I think is pure MVC-understanding)
I tend to create a "wrapping" library as soon as I need to connect two or more tables/models.


Messages In This Thread
Calling a Model from another Model - by El Forum - 06-07-2012, 06:02 AM
Calling a Model from another Model - by El Forum - 06-07-2012, 06:23 AM
Calling a Model from another Model - by El Forum - 06-07-2012, 07:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB