/ Published in: PHP
an alternative to a previous method i did using Zend Framework's autoloaders only. this method uses Doctrine's autoloaders for doctrine's classes and Zend's for Zend's :)
i think the difficulty i had was autoloading from a specific directory (with just Zend's autoloaders). eg. in Doctrine autoloaders i will do
new Doctrine\Common\ClassLoader(
'Application\Models',
APPLICATION_PATH . '/models'
);
where the 2nd param is the path to find the classes. basically,
- we create a resource method in `bootstrap.php`.
- in it, we setup doctrine in a similar way to how the doctrine sandbox sets it up. to setup autoloading of doctrine's classes, as we create new doctrine class loaders, we push them into the zend's autoloader.
- then its basically the same as the sandbox app, setting up caches, metadata drivers, proxies etc.
i think the difficulty i had was autoloading from a specific directory (with just Zend's autoloaders). eg. in Doctrine autoloaders i will do
new Doctrine\Common\ClassLoader(
'Application\Models',
APPLICATION_PATH . '/models'
);
where the 2nd param is the path to find the classes. basically,
- we create a resource method in `bootstrap.php`.
- in it, we setup doctrine in a similar way to how the doctrine sandbox sets it up. to setup autoloading of doctrine's classes, as we create new doctrine class loaders, we push them into the zend's autoloader.
- then its basically the same as the sandbox app, setting up caches, metadata drivers, proxies etc.