[eluser]01010011[/eluser]
Hi,
FOUND ERROR: I forgot to autoload doctrine in system\application\config\autoload.php
I keep getting this error message:
Quote:Fatal error: Class 'User' not found in C:\xampp\htdocs\ci_doctrine_day1\system\application\controllers\hello.php on line 17
when testing out this code:
Code:
<?php
// system/application/controllers/hello.php
class Hello extends Controller {
function world() {
echo "Hello CodeIgniter!";
}
function user_test() {
$u = new User; //****************Line 17**********************
$u->username = 'johndoe';
$u->password = 'secret';
$u->first_name = 'John';
$u->last_name = 'Doe';
$u->save();
$u2 = new User;
$u2->username = 'phprocks';
$u2->password = 'mypass';
$u2->first_name = 'Codeigniter';
$u2->last_name = 'Doctrine';
$u2->save();
echo "added 2 users";
}
}
Code:
<?php
// system/application/models/user.php
class User extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('username', 'string', 255);
$this->hasColumn('password', 'string', 255);
$this->hasColumn('first_name', 'string', 255);
$this->hasColumn('last_name', 'string', 255);
}
}
while following this tutorial:
Code:
http://www.phpandstuff.com/articles/codeigniter-doctrine-from-scratch-day-1-install-and-setup
Any ideas why I am getting this error message?