3

I can't install stof/doctrine-extensions-bundle with my Composer. I'm using Symfony2.1.9 version and a lot of problems are shown. The first one is:

the requested package stof/doctrine-extensions-bundle 1.1.* could not be found.

This is my composer.json file:

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": ">=2.2.3,<2.5-dev",
        "doctrine/doctrine-bundle": "1.1.*",
        "twig/extensions": "1.0.*@dev",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*",
        "kriswallsmith/assetic": "1.1.*@dev",
        "pagerfanta/pagerfanta": "dev-master",
        "white-october/pagerfanta-bundle": "dev-master",
        "friendsofsymfony/user-bundle": "dev-master",
        "saad-tazi/g-chart-bundle": "dev-master",
       "stof/doctrine-extensions-bundle": "1.1.*",
    },
    "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"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.1-dev"
        }
    }
}

when i set the package requirement to: "stof/doctrine-extensions-bundle": "1.1.*@dev" the response was: your requirement could not be resolved to an installable set of package

what could be the problem please?? should i install DoctrineExtensions first????

error message:

Problem 1
    - Conclusion: don't install symfony/symfony v2.1.10
    - Conclusion: remove symfony/symfony v2.1.9
    - Conclusion: don't install symfony/symfony v2.1.9
    - Conclusion: don't install symfony/symfony v2.1.8
    - Conclusion: don't install symfony/symfony v2.1.7
    - Conclusion: don't install symfony/symfony v2.1.6
    - Conclusion: don't install symfony/symfony v2.1.5
    - Conclusion: don't install symfony/symfony v2.1.4
    - Conclusion: don't install symfony/symfony v2.1.3
    - Conclusion: don't install symfony/symfony v2.1.2
    - Conclusion: don't install symfony/symfony v2.1.1
    - white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].
    - white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].
    - Can only install one of: symfony/symfony[v2.2.0, v2.1.0].
    - Can only install one of: symfony/symfony[v2.2.1, v2.1.0].
    - don't install symfony/framework-bundle v2.2.0|don't install symfony/symfony v2.1.0
    - don't install symfony/framework-bundle v2.2.1|don't install symfony/symfony v2.1.0
    - Installation request for symfony/symfony 2.1.* -> satisfiable by symfony/symfony[v2.1.0, v2.1.1, v2.1.10, v2.1.2, v2.1.3, v2.1.4, v2.1.5, v2.1.6, v2.1.7,v2.1.8, v2.1.9].
    - Installation request for white-october/pagerfanta-bundle dev-master -> satisfiable by white-october/pagerfanta-bundle[dev-master].
kenorb
  • 155,785
  • 88
  • 678
  • 743
smarttech
  • 133
  • 1
  • 4
  • 11

3 Answers3

9

The critical part in here is the following:

[...]
white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].
[...]

Which can lead to confusion! Let me explain:

Though it says the dependency is satisfiable by updating symfony/symfony to 2.2.0 or 2.2.1 ... this update is NOT NEEDED !! ( even if updating might be a good idea it is not necessary to resolve the issue and could lead to broken code because of BC [backward compatibility] breaks )

Attention:

Many bundles have a legacy branch ... for example a 2.1.x branch to support symfony/symfony 2.1.

Look for these branches on packagist prior to blindly updating your whole project to a new version of the root package!

Tip:

Generally if composer fails to fetch a dependency this is often related to the minimum stability for one of your required packages. minimum stability of all packages normally defaults to stable.

Solution:

smarttech used the wrong branch (dev-master) for white-october/pagerfanta-bundle to use it with symfony 2.1. The correct branch for 2.1 would have been:

"white-october/pagerfanta-bundle": "2.1.*@dev"

... where the @dev stability flag tells composer to use the dev version of doctrine-extensions-bundle for this single package. Please read more about composer's Stability Flags.

Take a quick look at the stability hierarchy:

dev < alpha < beta < rc < stable

Alternative:

Another way to solve the issue would have been setting composer's minimum stability.

Though this is not recommended as it applies to all constraints and as a result you will get unstable versions of all packages.

{

    [...]
    "require" :

        [...]

    "minimum-stability" : "dev",

    [...]

}
rkeet
  • 3,406
  • 2
  • 23
  • 49
Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
  • minimun-stability: dev is very bad. This will cause all bundles to clone the latest commit. This not helpfull developing own applications. – Emii Khaos May 21 '13 at 15:33
  • Don't do this as it's bad practice. – Emii Khaos May 21 '13 at 15:50
  • so sorry @nifr.please where to write this line.Sorry i am so confused – smarttech May 21 '13 at 15:56
  • @smarttech simply, don't do it. – Emii Khaos May 21 '13 at 15:57
  • Nice @Pazi ... you downvoted my answer and made smarttech unnecessarily update symfony to 2.2 ... So please remove your downvote on my answer which now provides the correct solution and necessary information. thx – Nicolai Fröhlich May 22 '13 at 08:31
  • Nothing wrong with using minimum-stability: dev. In fact its absolutely necessary if youre depending on packages that dont have stable versions tagged. Just use it with prefer-stable: true if youre worried about pulling in broken revisions on the packages that do have stable versions tagged – Erin Drummond Jan 09 '14 at 08:49
0

As the 1.1.x branch of the stof/doctrine-extensions-bundle is still only available as dev. So you have to declare it as a dev dependency in composer. Simply:

"stof/doctrine-extensions-bundle": "1.1.*@dev"

Next time take a look at packagist, which versions are available of a desired bundle.

EDIT: And yes, tested this requirement in a fresh symfony install and it works. So if you have errors, edit the complete error message in your question!

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
0

As this is a completly different answer. Your problem is not stof/doctrine-extensions-bundle, it's white-october/pagerfanta-bundle. Kids, read the error messages!

How i knew this? Simply copied your composer.json, executed update and got a meaning error message:

 white-october/pagerfanta-bundle dev-master requires symfony/framework-bundle >=2.2,<3.0 -> satisfiable by symfony/symfony[v2.2.0, v2.2.1], symfony/framework-bundle[v2.2.0, v2.2.1].

which means, actual versions of pagerfanta-bundle requires symfony 2.2, so you have to upgrade, if you want to use it.

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
  • thnx so much @Pazi ,That goes well now – smarttech May 21 '13 at 16:21
  • @smarttech Pazi pointed you to a WRONG solution. Though it worked for you now ... updating symfony to 2.2 was NOT necessary! In a large project this would have lead to all kinds of BC breaks in your code. My answer now contains all the information. Please accept it as it is the correct one. – Nicolai Fröhlich May 22 '13 at 08:17
  • thanks :-) though the hint to " actual versions of pagerfanta-bundle requires symfony 2.2" is not wrong itself ... the right solution would have been just using the right legacy branch. – Nicolai Fröhlich May 22 '13 at 08:33