Search code examples
phpjsonsymfonysonata

dependency hell: installing Sonata User


G'day all, I'm afraid yet another newbie is stuck trying to glue all the bits together. It's rather frustrating, to say the least :(

I've searched these forums, and see countless possible solutions, but none have worked so far. Most also also quite old, and versions have moved on.

Here we go:

https://sonata-project.org/bundles/user/2-2/doc/reference/installation.html

When I try this: composer require sonata-project/easy-extends-bundle

I get this:

Using version ^2.1 for sonata-project/easy-extends-bundle ./composer.json has been updated 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 - The requested package sonata-project/admin-bundle == 2.3.7.0 could not be found. Problem 2 - Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13]. - Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13]. - Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13]. - sonata-project/admin-bundle dev-master requires sonata-project/block-bundle ^2.3.8 -> satisfiable by sonata-project/block-bundle[2.3.8]. - Installation request for sonata-project/admin-bundle dev-master -> satisfiable by sonata-project/admin-bundle[dev-master]. - Installation request for sonata-project/block-bundle == 2.2.13.0 -> satisfiable by sonata-project/block-bundle[2.2.13].

Potential causes:- A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting

Installation failed, reverting ./composer.json to its original content.

I'm just following instructions, plain and simple! I read those articles, and tried a few solutions here, and via a Google search.

For what it's worth, I'm an old Unix hacker from way back, and I don't remember open source builds being this hard ...

Any clues? Many thanks in advance!

p.s. I'm using a Debian virtual box, as I thought it'd be easier than trying things on my Windows 8 PC.

Here is the only changed section from composer.json:

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "sonata-project/admin-bundle": "2.3.*",
    "sonata-project/doctrine-orm-admin-bundle": "^2.3",
    "sonata-project/easy-extends-bundle": "^2.1",
    "sonata-project/user-bundle": "^2.2",
    "sonata-project/easy-extends-bundle": "dev-master"
},

Solution

  • 1. Empty the vendor folder: Delete everything on it, but don't delete itself. Maybe a broken downloaded dependency is causing you issues.

    2. Replace your require section of your composer.json with this one:

    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "~1.3",
        "sonata-project/admin-bundle": "2.3.*",
        "sonata-project/doctrine-orm-admin-bundle": "^2.3",
        "sonata-project/easy-extends-bundle": "^2.1",
        "sonata-project/user-bundle": "^2.2"
    },
    

    Notice the difference about "friendsofsymfony/user-bundle" version.

    Now it should work! Let me know if it's still causing you issues.