require_once缺少doctrine zend框架

时间:2010-09-02 06:05:53

标签: php zend-framework command-line-interface require-once doctrine-orm

我正在将学说与Zend Framework集成。我遇到了从cli抛出的错误。似乎Zend_Application_Bootstrap_Bootstrap没有Zend_Application_Bootstrap_BootstrapAbstract的require_once。有人打过这个吗?

我的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)
));

3 个答案:

答案 0 :(得分:0)

Bootstrap类应扩展Bootstrap Abstract类。

class Bootstrap extends Zend_Application_Module_Bootstrap {
   //.....
}

答案 1 :(得分:0)

Zend_Application不使用require_once。它是ZF 1. *中需要Zend Autoloader的第一个软件包之一。

答案 2 :(得分:0)

是的,用Zend的自动加载器替换了doctrine类加载器。我不得不使用set_include_path将命名空间的路径直接添加到php路径。有没有更好的方法来做到这一点?我看到Doctrine的类加载器允许您指定路径和命名空间。感谢您的帮助beberlei和Alex

相关问题