views:

76

answers:

3

I'm integrating doctrine with Zend Framework. I've hit an error thrown from cli. It seems Zend_Application_Bootstrap_Bootstrap does not have a require_once for Zend_Application_Bootstrap_BootstrapAbstract. Has anyone hit this?

my cli-config.php

<?php

$classLoader = new \Doctrine\Common\ClassLoader('App', __DIR__ . "/../application/models");
$classLoader->register();

$classLoader = new \Doctrine\Common\ClassLoader('Cms', __DIR__ . "/../application/modules/cms-modules/models");
$classLoader->register();

$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__ . "/../application/models");
$classLoader->register();


$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
$driverImpl = $config->newDefaultAnnotationDriver(array(
        __DIR__."/../application/models/App",
        __DIR__."/../application/modules/cms-modules/models/Cms"
        ));
$config->setMetadataDriverImpl($driverImpl);

$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');


// Database connection information
$connectionOptions = array(
    'driver' => 'pdo_mysql',
    'dbname' => 'bella',
    'user' => 'username',
    'password' => 'password',
    'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
);

$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);

$helperSet = new \Symfony\Component\Console\Helper\HelperSet( array(
    'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
    'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
A: 

Bootstrap class should extends the Bootstrap Abstract class.

class Bootstrap extends Zend_Application_Module_Bootstrap {
   //.....
}
Alexander.Plutov
It does - and it works no problem via http. I suspect the autoloader has to be added to the cli-config as Zend_Application relies on it, as beberlie pointed out ???
waigani
A: 

Zend_Application does not use require_once. It is one of the first packages in ZF 1.* that requires the Zend Autoloader.

beberlei
It all works fine via a http request. The error is thrown when I try to build my db from my annotated models: doctrine orm:schema-tool:createI've added my cli-config to the question above. Do I need to add Zend Autoloader to the config?
waigani
can i point you to my next question please: http://stackoverflow.com/questions/3632623/doctrine2-zend-framework-namespaceing-controllers
waigani
A: 

Yep replacing the doctrine class loader with Zend's auto loader did the trick. I had to add the path to the namespaces directly to the php path using set_include_path. Is there a nicer way to do this? I see Doctrine's class loader allows you to specify both the path and namespace. Thanks for your help beberlei and Alex

waigani