将SF从2.8升级到3.x.x

时间:2019-02-25 10:13:57

标签: symfony migration symfony-2.8 symfony3.x

我从Symfony 2.8迁移到Symfony 3或更高版本时遇到问题。我已经尝试了几天的项目更新,但是我阻止了同样的错误。我尝试了所有可以在Google上找到的解决方案,但没有任何改进。这是我的文件composer.json

{
"name": "My/project",
"license": "proprietary",
"type": "project",
"autoload": {
    "psr-4": {
        "": "src/"
    },
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php"
    ]
},
"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "3.0.*",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "sonata-project/admin-bundle": "3.13",
    "sonata-project/doctrine-orm-admin-bundle": "^3.1",
    "friendsofsymfony/user-bundle": "^1.3",
    "sonata-project/core-bundle": "^3.1",
    "sonata-project/easy-extends-bundle": "^2.1",
    "sonata-project/user-bundle": "^3.2",
    "sonata-project/formatter-bundle": "^3.1",
    "knplabs/knp-paginator-bundle": "^2.5",
    "sonata-project/intl-bundle": "^2.3",
    "google/recaptcha": "^1.1",
    "twig/twig": "1.28.2",
    "friendsofsymfony/jsrouting-bundle": "^1.6",
    "helios-ag/fm-elfinder-bundle": "^6.2",
    "vich/uploader-bundle": "1.5.3",
    "beberlei/doctrineextensions": "^1.0",
    "simplethings/entity-audit-bundle": "^1.0",
    "sentry/sentry-symfony": "^1.0",
    "rollbar/rollbar": "~1.1",
    "mikey179/vfsstream": "^1.6"
},
"require-dev": {
    "sensio/generator-bundle": "~3.0",
    "doctrine/doctrine-fixtures-bundle": "^2.3",
    "hautelook/alice-bundle": "^2.0@beta",
    "nelmio/alice": "^3.0@beta",
    "theofidry/alice-data-fixtures": "^1.0@beta",
    "symfony/phpunit-bridge": "^4.2",
    "phpunit/phpunit": "^6.1",
    "behat/behat": "^3.4",
    "behat/mink": "^1.7",
    "behat/mink-selenium2-driver": "^1.3",
    "behat/symfony2-extension": "^2.1",
    "behat/mink-extension": "^2.2",
    "behat/mink-browserkit-driver": "^1.3",
    "behat/mink-goutte-driver": "^1.2",
    "emuse/behat-html-formatter": "^0.1.0",
    "phing/phing": "2.*"
},
"scripts": {
    "symfony-scripts": [
        "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",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-install-cmd": [
        "@symfony-scripts"
    ],
    "post-update-cmd": [
        "@symfony-scripts"
    ]
},
"config": {
    "component-dir": "web/assets"
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-bin-dir": "bin",
    "symfony-var-dir": "var",
    "symfony-web-dir": "web",
    "symfony-tests-dir": "tests",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    }
}

}

我使用此命令来更新:$ composer update symfony/symfony --with-dependencies --no-scripts

更新未完成,因为显然我与依赖关系的不同版本冲突。.但是我无法在较新的版本中更新依赖关系

enter image description here

请需要您的帮助。.

1 个答案:

答案 0 :(得分:0)

您有一个冲突,因为您不能同时拥有symfony/symfony 3.0.*symfony/cache 3.4

实际上,您已锁定版本的其他捆绑软件与symfony 3.0不兼容,因此您也需要将其捆绑。

最小可行方法是使用这些依赖项:

"symfony/symfony": "3.2.*",
"friendsofsymfony/user-bundle": "^2.0",
"sonata-project/user-bundle": "^4.0",

然后只运行composer install而不是composer update symfony/symfony。 Composer将完成其工作,然后您必须调整代码以减轻所有BC中断,等等...

如果您无法更改其他依赖项,请然后再使用Sf 2.8