Question

I've been using Symfony 2.2 for quite a while and recently decided to upgrade to 2.4.

After running a composer update I receive this error message. It seems that the framework isn't able to find 'setDispatcher()' method for an unknown reason.

./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.

I've been searching a lot but couldn't find any similar issue.

Maybe someone has seen something like this before. Here is my composer.json. I think the problem could be related to this file.

{
    "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"
        }
    }
}
Was it helpful?

Solution

Ok, I found out what produced the error. The console version was to old resulting in loading the wrong class producing the error above.

Replacing

"symfony/console": "2.2.*@dev",

with

"symfony/console": "2.5.*@dev",

solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top