Welcome Guest, Not a member yet? Register   Sign In
Call a model from another model
#1

[eluser]xxIdroxx[/eluser]
Hello, i have a model called "I_Model" and I want to call another model called x_Model.
How do I?
#2

[eluser]jairoh_[/eluser]
Do not call another model from a model. that's not the mvc pattern thing. u just need to call a model in a controller.
#3

[eluser]boltsabre[/eluser]
Depending on the application you may want to have a model extend another model, there is absolutely nothing wrong with that in my opinion.

A classic example is having a base "product" model and from their having several models extending it, perhaps a "buy_product", a "sell_product", a "admin_panel_for_product", a "product_inventory", etc. Your "base" product model would contain all the universal "product" methods that the other child models need.

The above mentioned scenario is no different than having a "MY_Model", except it's on a bit more of a micro/specific scale.

Quote:How do I?
Have you tried looking for the answer on a search engine, this has been answered literally 100's of times already. Try this:
https://www.google.com/search?q=codeigni...ther+model

If you have any problems please next time post your code that is causing the problem and describe the error that you are getting.
#4

[eluser]xxIdroxx[/eluser]
Thanks, I solved the problem!




Theme © iAndrew 2016 - Forum software by © MyBB