Hello all,
I'm new to doctrine. I created an bootstrap file like the following one:
require_once(dirname(__FILE__)."/../conf/general.php");
require_once(dirname(__FILE__).'/Doctrine/lib/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
$manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true); #for accessor overriding
$manager->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES, true); #in order to be able to use the XTable classes
$manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE); #to conservatively load files
$manager->setAttribute(Doctrine::ATTR_EXPORT, Doctrine::EXPORT_ALL);
$dsn = "mysql:dbname=".DBNAME.";host=".DBHOST;
$dbh = new PDO( $dsn, DBUSERNAME, DBPASS );
$conn = Doctrine_Manager::connection( $dbh );
Doctrine_Core::loadModels('doc_models'); #In order to be able to work with models
php bootstrap.phpcommand works just as expected. But I have a file X.php under directory Y and i require bootstrap.php file in X.php ;but when i ran the X.php in the directory Y like
php X.phpI got the following exception:
Doctrine_Exception: You must pass a valid path to a directory containing Doctrine models in /path_to_directory_of_bootstrap_file/Doctrine/lib/Doctrine/Core.php on line 635
Now, how can i fix this issue?
BTW, when i put X.php and bootstrap.php in the same directory it works as expected. I also tried to require with absolute paths but this didn't solve my problem. I'm testing on Ubuntu 9.10 and installed doctrine from pear. Doctrine version is 1.2.0.