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

[eluser]Marcela[/eluser]
load a library inside a model and everything is ok,

but if i use:

Code:
$this->load->model('othermodel'); // until here is ok

$avar = $this->othermodel->amethod(); // what happen ???

Then I get this error message:

Quote:Severity: Notice

Message: Undefined property: othermodel
#2

[eluser]Eric Barnes[/eluser]
Yes you have to do some other changes to load a model in a model. It is not a feature out of the box and really bad design wise. But if this is something you really want to do I recommend searching the forums. This has been answered many many times.
#3

[eluser]Thorpe Obazee[/eluser]
Loading a model from withing a model.

Code:
class Project_model extends Model {

    function Project_model()
    {
        parent::Model();
    }

    function save()
    {
        $CI =& get_instance();

        $CI->load->model('service_model');

        $CI->service_model->get_services();
    }
}
#4

[eluser]Marcela[/eluser]
Thanks for your anwsers. I will try extending my models instead.




Theme © iAndrew 2016 - Forum software by © MyBB