maxime
maxime

Reputation: 2315

How to fix Symfony requirements which could not be resolved by composer?

I would install the Sonata User Bundle, but when I try to do a composer update, console returns me these errors:

    C:\wamp\www\extranet>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for sonata-project/doctrine-orm-admin-bundle 2.1.*@de
v -> satisfiable by sonata-project/doctrine-orm-admin-bundle[2.1.x-dev].
    - Conclusion: remove symfony/symfony v2.3.1
    - sonata-project/doctrine-orm-admin-bundle 2.1.x-dev requires symfony/symfon
y >=2.1,<2.3 -> satisfiable by symfony/symfony[v2.1.0, v2.1.1, v2.1.10, v2.1.11,
 v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7, v2.1.8, v2.1.9, v2.2.0, v2.2.1,
 v2.2.2, v2.2.3].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.0].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.1].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.10].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.11].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.2].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.3].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.4].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.5].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.6].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.7].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.8].
    - Can only install one of: symfony/symfony[v2.3.1, v2.1.9].
    - Can only install one of: symfony/symfony[v2.3.1, v2.2.0].
    - Can only install one of: symfony/symfony[v2.3.1, v2.2.1].
    - Can only install one of: symfony/symfony[v2.3.1, v2.2.2].
    - Can only install one of: symfony/symfony[v2.3.1, v2.2.3].
    - Installation request for symfony/symfony 2.3.1 -> satisfiable by symfony/s
ymfony[v2.3.1].

And here is my composer.json:

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": {
        "": "src/"
    }
},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.1",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "symfony/icu": "1.2.*",
    "jms/security-extra-bundle": "dev-master",
    "friendsofsymfony/user-bundle": "dev-master",
    "sonata-project/block-bundle": "2.1.*",
    "sonata-project/admin-bundle": "2.1.*",
    "sonata-project/user-bundle": "2.1.*@dev",
    "sonata-project/doctrine-orm-admin-bundle": "2.1.*@dev",
    "sonata-project/intl-bundle": "2.1.*",
    "sonata-project/cache-bundle": "2.1.*"
},
"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "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": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "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": "stable",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },
    "branch-alias": {
        "dev-master": "2.3-dev"
    }
}

}

I tried a lot of things (change versions, accept alpha minimum stability, etc.) and searched the issue in a lot of forums, but I didn't find the solution which fixed my problem.

Upvotes: 1

Views: 5704

Answers (1)

Danack
Danack

Reputation: 25721

You are explicitly listing an old version of sonata-project/doctrine-orm-admin-bundle and it is not compatible with other libaries.

You have this:

"sonata-project/doctrine-orm-admin-bundle": "2.1.*@dev",

Which apparently has a requirement of:

 sonata-project/doctrine-orm-admin-bundle 2.1.x-dev requires symfony/symfony >=2.1,<2.3

Unless you definitely need the absolutely latest version you shouldn't be used @dev at all, and you should be using tilde to get the latest tagged version e.g.

"sonata-project/doctrine-orm-admin-bundle": "~2.1",

Will get the latest version of sonata-project/doctrine-orm-admin-bundle that is greater >= 2.1 and < 3.0.

Upvotes: 4

Related Questions