Welcome Guest, Not a member yet? Register   Sign In
Doctrine - Undefined property MODELNAME:$_table
#1

[eluser]msteudel[/eluser]
I've been following this tutorial to integrate codeigniter and doctrine:
http://www.phpandstuff.com/articles/code...-and-setup

I'm running into a problem where I'm trying to get results from a model by doing this

Code:
$data['districts'] = Doctrine_Record::getTable('district')->findAll()->toArray();

And I am getting:
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: District::$_table

Filename: Doctrine/Record.php

Line Number: 1095



Here's my doctrine.php model:
Code:
class district extends Doctrine_Record
{
    public function setTableDefinition() {
        // $this->setTableName('districts');
        $this->hasColumn('id', 'integer', 4, array(
             'type' => 'integer',
             'primary' => true,
             'unsigned' => true,
             'autoincrement' => true,
             'length' => '4',
             ));
        $this->hasColumn('district_name', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'length' => '255',
             ));
        $this->hasColumn('state_id', 'integer', 4, array(
             'type' => 'integer',
             'unsigned' => true,
             'notnull' => true,
             'length' => '4',
             ));


        $this->option('collation', 'latin1_swedish_ci');
        $this->option('charset', 'latin1');
        $this->option('type', 'MyISAM');
    }

    public function setUp() {
        parent::setUp();
    $this->actAs('Timestampable');
    }
}
I can do other doctrine things like:
Code:
echo Doctrine_Core::getPath();

And it'll spit out the path ....

Anything else I can provide that might be helpful?




Theme © iAndrew 2016 - Forum software by © MyBB