Welcome Guest, Not a member yet? Register   Sign In
[Modular Extension] Model bug
#1

[eluser]grisha[/eluser]
I've tested this on a clean CI 1.7.1

Controller:
application/modules/welcome/controllers/welcome.php

Code:
<?php
class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->model('TestModel');
        $this->load->view('welcome_message');
        $this->TestModel->A();
    }
}

/* End of file welcome.php */
/* Location: ./system/application/modules/welcome/controllers/welcome.php */

And the model:

Code:
<?php
class TestModel extends Model {

    function TestModel()
    {
        parent::Model();    
    }
    
    function A()
    {
        echo "Bark";
    }
}

/* End of file TestModel.php */
/* Location: ./system/application/models/TestModel.php */
?>

Error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI::$TestModel

Filename: libraries/Controller.php

Line Number: 95

It doesn't matter if the model is in
./system/application/models/TestModel.php
or
./system/application/modules/welcome/models/TestModel.php

When I print_r($this) after loading the view all I get is:
Code:
Welcome Object ( [_module:protected] => welcome [_ci_cached_vars] => Array ( ) [_ci_classes] => Array ( ) [load] => Welcome Object *RECURSION* )

Version tested: 5205, 5206

If I'm wrong with something - sorry and please give me an advice, what to do.


Messages In This Thread
[Modular Extension] Model bug - by El Forum - 04-19-2009, 08:19 AM
[Modular Extension] Model bug - by El Forum - 04-20-2009, 10:49 AM
[Modular Extension] Model bug - by El Forum - 04-20-2009, 12:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB