Sonata Bundle 之间的依赖关系

Posted

技术标签:

【中文标题】Sonata Bundle 之间的依赖关系【英文标题】:Dependencies between Sonata's Bundles 【发布时间】:2016-09-10 05:27:56 【问题描述】:

我创建了一个 Symfony 应用程序并添加到我的 composer.json 中:

奏鸣曲项目/管理包 奏鸣曲项目/格式化程序包 奏鸣曲项目/国际捆绑 奏鸣曲项目/媒体包 奏鸣曲项目/分类包 奏鸣曲项目/用户捆绑包

当我使用时

作曲家安装

一切正常。但是当我想更新时,我有太多的依赖错误,例如,user-bundle 需要 admin-bundle 2.x-dev 和分类-bundle 需要 admin-bundle 3.0.0。我为每个奏鸣曲捆绑包尝试了不同的(包括 dev-master)。

有人可以帮助我吗?

【问题讨论】:

【参考方案1】:

我的 composer.json:


"name": "navalex/.checkout",
"license": "proprietary",
"type": "project",
"minimum-stability": "dev",
"autoload": 
    "psr-4": 
        "": "src/"
    ,
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php"
    ]
,
"require": 
    "php": ">=5.3.9",
    "symfony/symfony": "2.8.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "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",

    "ornicar/gravatar-bundle": "^1.1",
    "coresphere/console-bundle": "dev-master",
    "whiteoctober/breadcrumbs-bundle": "^1.2",
    "stof/doctrine-extensions-bundle": "^1.2",

    "sonata-project/admin-bundle": "3.0.0",
    "sonata-project/block-bundle": "3.0.0",
    "sonata-project/doctrine-orm-admin-bundle": "3.0.0",
    "sonata-project/easy-extends-bundle": "^2.1",
    "sonata-project/formatter-bundle": "^2.3",
    "sonata-project/intl-bundle": "^2.2",
    "sonata-project/media-bundle": "^2.3",
    "sonata-project/classification-bundle": "^2.2",
    "sonata-project/user-bundle": "^2.2"
,
"require-dev": 
    "sensio/generator-bundle": "~3.0",
    "symfony/phpunit-bridge": "~2.7"
,
"scripts": 
    "post-install-cmd": [
        "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-update-cmd": [
        "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"
    ]
,
"config": 
    "bin-dir": "bin",
    "platform": 
        "php": "5.5"
    
,
"extra": 
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": 
        "file": "app/config/parameters.yml"
    

【讨论】:

【参考方案2】:

你能粘贴你需要的版本吗?

如果您需要更宽松的版本,该问题可能会得到解决。例如,如果您要求它们全部为v3.0.0,如果库的标签策略设计不当,您可能会遇到错误。但是,如果您使用*,那么composer 可能会找到一个满足所有交叉要求的版本。

【讨论】:

以上是关于Sonata Bundle 之间的依赖关系的主要内容,如果未能解决你的问题,请参考以下文章

Sonata Admin Bundle:按计数一对多关系排序

如何在 Sonata Media Bundle 中实现多对多关系

Sonata Admin Bundle 和 Doctrine 问题:如何从反面更新实体?

webpack之webpack和vite的区别

类之间的依赖关系和组合关系

Sonata 产品列表错误(Sonata E-Commerce Bundle)