我整合学说与Zend框架。我已经打从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)
));
有帮助吗?

解决方案

Bootstrap类应延伸的引导抽象类。

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

其他提示

Zend_Application不使用require_once。它是在ZF 1 *在第一包需要在Zend自动加载机中的一个。

是的与Zend的自动加载器更换学说的类加载器的伎俩。我不得不路径直接添加到命名空间使用通过set_include_path php的路径。有没有更好的方式来做到这一点?我看到主义的类加载器可以让你同时指定路径和命名空间。感谢您的帮助beberlei和Alex

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top