【发布时间】:2014-03-13 12:00:47
【问题描述】:
我的所有 url 网站都有这个返回 symfony 错误:
"ClassNotFoundException: Attempted to load class "DoctrineFixturesBundle" from namespace "Doctrine\Bundle\FixturesBundle" in C:\dev\Apache2.4.6\htdocs\MySite\app\AppKernel.php line 23. 你需要“使用“它来自另一个命名空间?”
当我修改 config.yml(部分教义 orm)以解决其他问题时出现此错误,但它没有解决。确实支持我在此文件中的更改并重新运行我的网站,但现在没有任何运行正常。我随时随地都有这个错误。
我在这里复制我的代码,但只是为了回答简单的问题:
- 你是否在 AppKernel.php 中添加了这一行 : $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); ? 回答:是的
- 你有安装固定装置包吗? 回复:是
- 你有安装/更新和自我更新作曲家吗? 回复:是
- 你在 DB 中有负载装置吗? 响应:是的(它运行完美)
- 你有清理缓存吗? 响应:是
我所有的灯具引擎都在这产生错误之前正确运行。
AppKernel.php
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
composer.json
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "2.4.2",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/doctrine-fixtures-bundle": "dev-master"
},
config.yml
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
感谢您的宝贵帮助
【问题讨论】:
标签: symfony doctrine-orm