Upgrading Sonata from 2.3 to 3.0

别来无恙 提交于 2019-12-23 23:06:22

问题


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?


回答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.



来源:https://stackoverflow.com/questions/38701154/upgrading-sonata-from-2-3-to-3-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!