i am a new user to doctrine and i hit this brick wall. this bug report was all that saved me, and it is a bit misleading. my test results are below. in the end i found a combination that worked, but this seems like a glaring bug especially since the pdf takes the user right down a path that fails completely in all cases (default aggressive loading, doesn't work for me at all).
i am using a pear loaded version 1.2 on ubuntu
here are my test results:
---------------------------------------------------------------------------------------------------
case 1: load models right after generating them, without modelsAutoLoad() call: SUCCESS/FAIL varies
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');
in test.php:
<?
require_once('doctrine_bootstrap.php');
Doctrine_Core::generateModelsFromDb('models', array('doctrine'), array('generateTableClasses' => true));
Doctrine_Core::loadModels('models');
---------------------------------------------------------------------------------------------------
case 2: load models after they have already been generated, without modelsAutoLoad() call: FAIL
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');
in test.php:
<?
// note: all model classes are in ./models and ./models/generated
require_once('doctrine_bootstrap.php');
Doctrine_Core::loadModels('models');
---------------------------------------------------------------------------------------------------
case 3: load models after they have already been generated, with the modelsAutoLoad() call and default aggressive setting: FAIL
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
in test.php:
<?
// note: all model classes are in ./models and ./models/generated
require_once('doctrine_bootstrap.php');
Doctrine_Core::loadModels('models');
---------------------------------------------------------------------------------------------------
case 4: load models after they have already been generated, with the modelsAutoLoad() call and conservative loading: SUCCESS
---------------------------------------------------------------------------------------------------
in doctrine_bootstrap.php file:
<?
require_once('lib/vendor/doctrine/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$conn = Doctrine_Manager::connection('mysql:// DSN REMOVED ','doctrine');
$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
in test.php:
<?
// note: all model classes are in ./models and ./models/generated
require_once('doctrine_bootstrap.php');
Doctrine_Core::loadModels('models');
Same problem here following the same example of the 1.2 tutorial.