Class 'Doctrine_Record' not found

Go To StackoverFlow.com

4

This started over here when I was getting Class 'Classname_model' not found. I fixed this by explicitly calling that class.

However, it revealed another problem:

Fatal error: Class 'Doctrine_Record' not found in /../application/models/classname_model.php on line 7

Here is line 7:

class Classname_model extends Doctrine_Record {

Now, I'm incredibly new at Doctrine, CodeIgniter, and all things OOP/MVC.

Might there be a problem with my Doctrine install or configuration?

2012-04-04 19:50
by jeremy
Sounds like you've not included the Doctrine library, or not added it to you autoloader - Lee Davis 2012-04-04 20:08


0

Doctrine_Record is part of Doctrine 1.x. Doctrine 2.x is a complete rewrite and has no such class. So start by bringing down the latest Doctrine 1.x. And then you will need to take some time to understand autoloading and include path stuff. Find a simple tutorial and work you way through it.

2012-04-04 20:09
by Cerad
I think maybe jeremy tagged it incorrectly, should be "doctrine - Lee Davis 2012-04-04 20:12
Yep but if you read the question he linked then it's clear that he actually downloaded D2 instead of D1 - Cerad 2012-04-04 20:15
Its true, I'm trying to use Doctrine 2, but am cobbling together tutorials from the web, and at least one of them refers to Doctrine 1. So this is almost certainly my problem. I'm headed back to the drawing board, thanks - jeremy 2012-04-04 20:24


1

Bootstrapping Doctrine and your models...

spl_autoload_register(array('Doctrine', 'autoload')); //First set the doctrine autoloader

$manager = Doctrine_Manager::getInstance();
$manager->setCharset('UTF8');    
$manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
$manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);

spl_autoload_register(array('Doctrine', 'modelsAutoload'));
Doctrine_Core::loadModels(__PATH_TO_YOUR_MODELS__);  
2012-04-04 20:10
by Lee Davis
Ads