Getting started - Installation - Include and autoload.php 833 Bytes
Newer Older
1 2
In order to use Doctrine in your project it must first be included.

3 4
<code type='php'>
require_once('path-to-doctrine/lib/Doctrine.php');
5 6 7 8 9 10
</code>

Doctrine support [http://www.php.net/autoload Autoloading] for including files so that you do not have to include anything more then the base file. There are two different strategies that can be used to do this:

If you do use the **__autoload** function for your own logic you can use it. 

11
<code type='php'>
12 13 14 15 16 17 18 19 20 21
function __autoload($class) {
	Doctrine::autoload($class);
}
</code>

If your project uses autoload and/or you have other libraries that use it you could use [http://www.php.net/manual/en/function.spl-autoload-register.php spl_autoload_register] to register more then one autoloading function. 

<code type="php">
spl_autoload_register(array('Doctrine', 'autoload'));
</code>