我已经使用Symfony 2.2很长一段时间了,最近决定升级到2.4。
运行编辑器更新后,我收到此错误消息。似乎框架无法找到'setDispatcher()'方法,原因不明。
./composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
....
Writing lock file
Generating autoload files
PHP Fatal error: Call to undefined method Symfony\Bundle\FrameworkBundle\Console\Application::setDispatcher() in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php on line 86
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
我一直在搜索,但找不到任何类似的问题。
也许有人之前见过这样的事情。这是我的composer.json。我认为问题可能与此文件有关。
{
"name": "my blogsoftware",
"description": "A Blog software distribution",
"license": "proprietary",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"kriswallsmith/assetic": "1.1.*@dev",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~2.3",
"sensio/generator-bundle": "~2.3",
"symfony/console": "2.2.*@dev",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/data-fixtures" : "dev-master",
"friendsofsymfony/user-bundle": "2.0.*@dev",
"doctrine/doctrine-migrations-bundle": "2.1.*@dev",
"doctrine/migrations": "1.0.*@dev",
"sonata-project/core-bundle" : "2.2.*@dev",
"sonata-project/admin-bundle": "2.2.*@dev",
"sonata-project/doctrine-orm-admin-bundle": "2.2.*@dev",
"sonata-project/intl-bundle": "2.2.*@dev",
"sonata-project/cache-bundle": "2.1.*@dev",
"sonata-project/block-bundle": "2.2.*@dev",
"sonata-project/notification-bundle": "2.2.*@dev",
"simplethings/entity-audit-bundle": "dev-master",
"knplabs/knp-menu-bundle":"1.1.x-dev",
"vich/uploader-bundle": "dev-master",
"knplabs/knp-gaufrette-bundle": "0.2.*@dev",
"knplabs/gaufrette": "0.2.*@dev",
"genemu/form-bundle": "2.2.*@dev",
"eko/feedbundle": "1.1.*@dev",
"facebook/php-sdk": "3.2.0",
"friendsofsymfony/facebook-bundle": "dev-master",
"shark/simple_html_dom": "dev-master",
"incenteev/composer-parameter-handler": "2.1.*@dev"
},
"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": "beta",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.4-dev"
}
}
}
答案 0 :(得分:0)
好的,我发现了产生错误的原因。控制台版本很旧,导致加载错误的类产生上述错误。
更换
"symfony/console": "2.2.*@dev",
与
"symfony/console": "2.5.*@dev",
解决了这个问题。