require_once缺少教义zend框架 [英] require_once missing doctrine zend framework
本文介绍了require_once缺少教义zend框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的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');
//数据库连接信息
$ 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类应该扩展Bootstrap抽象类。 p>
class Bootstrap extends Zend_Application_Module_Bootstrap {
// .....
}
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)
));
解决方案
Bootstrap class should extends the Bootstrap Abstract class.
class Bootstrap extends Zend_Application_Module_Bootstrap {
//.....
}
这篇关于require_once缺少教义zend框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文