Welcome Guest, Not a member yet? Register   Sign In
Problem loading model
#1

[eluser]Unknown[/eluser]
Hi all!
It's my first time with CI. Always i build my apps writing all the code!

So, I found a problem accidentally when I was writing a class. I'm not sure it's a bug, maybe the admin will have to move this topic to another category.

The problem is simple.

I have this code:

Code:
class A extends Model {

    function A()
    {
        // Call the Model constructor
        parent::Model();
        $this->load->model('B');
    }
}


class B extends Model {

    function B()
    {
        // Call the Model constructor
        parent::Model();
        $this->load->model('A');
    }
}

So, A load B and B load A.

This launch this error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261900 bytes) in C:\xampp\htdocs\prestamit\system\codeigniter\Base5.php on line 154

An infinite loop.

Maybe it's wrong to load a model from another model.

It's a bug?

Thank you! Cheers.


Messages In This Thread
Problem loading model - by El Forum - 12-16-2009, 08:29 PM
Problem loading model - by El Forum - 12-18-2009, 12:22 AM
Problem loading model - by El Forum - 12-18-2009, 12:50 AM
Problem loading model - by El Forum - 12-18-2009, 10:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB