我的Symfony2设置一切都很棒,直到我开始搞乱Composer。
我确实使用Composer安装了Symfony2,但随后手动添加了捆绑包 - 包括我自己创建的捆绑包。
然后,我需要添加一些使用Composer更容易的东西。稍后在终端中搞乱了很多我然后发现当我在浏览器中运行时,我在AppKernel.php中收到错误,说没有捆绑存在 - 包括:
FatalErrorException: Error: Class 'Acme\DemoBundle\AcmeDemoBundle' not found in /path/app/AppKernel.php line 39
我100%存在文件夹,除了运行各种Composer命令之外没有任何改变。
Composer没有引用这些包。
我该如何解决这个问题?我猜我要么告诉Composer要清除(像之前一样),要么以某种方式让Composer理解这些包。
我猜它与bootstrap文件有关。我相信Composer会在更新后创建一个,但这是我在努力的地方。
-
composer.json:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
"symfony-web-dir": "web",
"symfony-app-dir": "app",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
}
答案 0 :(得分:1)
我认为您没有更新app/autoload.php
文件。检查标准分发的来源:https://github.com/symfony/symfony-standard/blob/master/app/autoload.php
您需要加入由作曲家生成的vendor/autoload.php
。