2

I have an existing Symfony + SonataAdmin project which we've been running for a few years. I'd like to upgrade it to SonataAdmin 3.x. 3.0 would be a good start, then moving up to 3.x afterwards once we check it's all working.

However, I can't seem to get a viable set of composer dependencies to upgrade. The current settings include:

    "sonata-project/admin-bundle": "~2.3",
    "sonata-project/core-bundle": "~2.3",
    "sonata-project/doctrine-orm-admin-bundle": "~2.3",
    "sonata-project/user-bundle": "~2.3@dev",
    "sonata-project/datagrid-bundle": "~2.2@dev",
    "friendsofsymfony/user-bundle": "~1.3",

I've tried changing the first three to 3.0.* but I get the following error:

$ composer update --dry-run

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

- sonata-project/user-bundle 2.x-dev requires sonata-project/core-bundle ~2.2 -> satisfiable by sonata-project/core-bundle[2.2.0-2.2.7, 2.3.0-2.3.11, 2.x-dev] but these conflict with your requirements or minimum-stability.

- sonata-project/user-bundle 2.3.x-dev requires sonata-project/admin-bundle ~2.3|~2.4@dev -> satisfiable by sonata-project/admin-bundle[2.3.0-2.3.10, 2.x-dev] but these conflict with your requirements or minimum-stability.

- Installation request for sonata-project/user-bundle ~2.3@dev -> satisfiable by sonata-project/user-bundle[2.x-dev, 2.3.x-dev].

Chaging the dependency for user-bundle to:

"sonata-project/user-bundle": "3.0.*@dev",

or 3.0.*@dev, or 3.0.0 or 3.0.0@dev:

Just gives a different error:

$ composer update --dry-run

Loading composer repositories with package information

Updating dependencies (including require-dev)

[Composer\DependencyResolver\SolverProblemsException]

Problem 1

  - The requested package sonata-project/user-bundle 3.0.* exists as sonata-project/user-bundle[2.3.x-dev, dev-master] but these are rejected by your constraint.

And, finally, trying "sonata-project/user-bundle": "dev-master", gives this error:

$ composer update --dry-run

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

- sonata-project/user-bundle dev-master requires sonata-project/admin-bundle ^3.1 -> satisfiable by sonata-project/admin-bundle[3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.4.0, 3.x-dev] but these conflict with your requirements or minimum-stability.

- sonata-project/user-bundle dev-master requires sonata-project/admin-bundle ^3.1 -> satisfiable by sonata-project/admin-bundle[3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.4.0, 3.x-dev] but these conflict with your requirements or minimum-stability.

- Installation request for sonata-project/user-bundle dev-master -> satisfiable by sonata-project/user-bundle[dev-master].

So... is there any version of sonata-project/user-bundle which is compatible with the 3.0.* versions of the other Sonata packages? Packagist seems to suggest that there's a 3.0.0 version of sonata-project/user-bundle, but haveI done something wrong in my composer syntax when trying to reference it?

caponica
  • 3,788
  • 4
  • 32
  • 48
  • Why use `3.0.0`? That's not very liberal. Try using `^3.0` everywhere, maybe? And then restrict to `3.0.0` if you really want to (but since there is no BC-break between `3.0` and `3.1`, it's pretty useless IMO). If anything, you will miss some bugfixes. – greg0ire Aug 01 '16 at 15:02
  • OK, Using `^3.0` for the first three and `sonata-project/user-bundle: dev-master` resolves. But I haven't run it yet to find out how much pain is involved in the upgrade! I just wanted to get from 2.3 -> 3.0 first to get things working with 3.something and then upgrade to the latest 3.x from there. But maybe it's better just to go straight to ^3.0. – caponica Aug 01 '16 at 15:57
  • I really think so. – greg0ire Aug 01 '16 at 18:35
  • Will do - thank you! – caponica Aug 01 '16 at 20:48
  • BTW, you don't need to user dev-master for the user bundle, or for anything – greg0ire Aug 01 '16 at 21:02

1 Answers1

1

Rules to achieve your goal with ease :

  • use stable versions and only that
  • don't constraint yourself too much, you can do it later.

Here is an excerpt of a composer.json of mine :

    "sonata-project/admin-bundle": "^3.0",
    "sonata-project/core-bundle": "^3.0",
    "sonata-project/doctrine-orm-admin-bundle": "^3.0",
    "sonata-project/notification-bundle": "^3.0",
    "sonata-project/user-bundle": "^3.0",

Simple and beautiful.

greg0ire
  • 22,714
  • 16
  • 72
  • 101