I want to use Doctrine 1 inside a Zend Framework 2 project. And it has the old underscore/directory class naming style. If I am right that is compatible with the PSR0 autoloading. So I configured it as I thought would be correct. But it's not. :-(
I get the following error, when accessing my AlbumController via browser:
Fatal error: Class 'AlbumApi\Controller\Doctrine_Query' not found in /project/application_zf2/module/AlbumApi/src/AlbumApi/Controller/AlbumController.php on line [...]
Where is my misconception?
This is my project structure
/project
/application
/application_zf2
/module/AlbumApi/src/AlbumApi/Controller
/AlbumController.php
/composer.json
/init_autoloader.php
/library
/Doctrine
/Doctrine/MoreDirectories
/Doctrine.php
composer.json:
{
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": ">=2.2.4",
"zendframework/zend-developer-tools": "dev-master"
},
"include-path": ["../library/Doctrine"],
"autoload": {
"psr-0": {
"Doctrine_": "../library/Doctrine"
}
}
}
AlbumController
<?php
namespace AlbumApi\Controller;
use AlbumApi\Controller\AbstractRestfulJsonController;
use Zend\View\Model\JsonModel;
class AlbumController extends AbstractRestfulJsonController
{
public function getList()
{ // Action used for GET requests without resource Id
$query = Doctrine_Query::create()
->from('User b')
->where('b.plz LIKE ?', $plz.'%');
$result = $query->fetchArray();
return new JsonModel($result);
}
}