dslfjrmz70457 2015-12-08 12:05
浏览 61
已采纳

ScopeCrossingInjectionException:Symfony2.7

Everything was working fine on my website, until i decided to add in my composer.json those line:

  • "avocode/form-extensions-bundle": "dev-master"
  • update from dev-master to version: "components/jquery": "2.0",
  • "components/jqueryui": "1.11.4"
  • "component-dir": "web/assets"

After update composer.json i got this error :

ScopeCrossingInjectionException in CheckReferenceValidityPass.php line 146:

Scope Crossing Injection detected: The definition "sonata.admin.builder.orm_datagrid" references the service "sonata.admin.builder.filter.factory" which belongs to another scope hierarchy. This service might not be available consistently. Generally, it is safer to either move the definition "sonata.admin.builder.orm_datagrid" to scope "prototype", or declare "container" as a child scope of "prototype". If you can be sure that the other scope is always active, you can set the reference to strict=false to get rid of this error.

I tried everything that i could to fix this error but i'm still having it. i deleted all the new line that i added, but still doesn't work.

This is my composer.json:

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/", "SymfonyStandard": "app/" }

    },
    "minimum-stability": "dev",

    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.4",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "2.6.0",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~3.0,>=3.0.12",
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "leafo/lessphp": "*",
        "twitter/bootstrap": "*",
        "mremi/contact-bundle": "dev-master",
        "symfony/twig-bridge": "2.3.*",
        "genemu/form-bundle": "2.2.*",
        "components/jquery":"dev-master",
        "friendsofsymfony/user-bundle": "~1.3",
        "hwi/oauth-bundle": "0.4.*@dev",

        "knplabs/gaufrette": "~0.1.6",
        "knplabs/knp-menu-bundle": "~2.0",

        "sonata-project/user-bundle": "2.3.*@dev",
        "sonata-project/block-bundle": "~2.3@dev",
        "sonata-project/admin-bundle": "~2.4@dev",
        "sonata-project/page-bundle": "~2.3",
        "sonata-project/datagrid-bundle": "2.2.*@dev",
        "symfony-cmf/routing-bundle": "~1.1",
        "sonata-project/core-bundle": "~2.2@dev",
        "sonata-project/doctrine-orm-admin-bundle": "~2.2",
        "sonata-project/easy-extends-bundle": "~2.1",
        "sonata-project/comment-bundle": "~2.2@dev",
        "sonata-project/ecommerce": "dev-develop",
        "tetranz/select2entity-bundle": "2.*",
        "zendframework/zend-crypt"          : "dev-master",
        "cocur/slugify"                     : "1.4.x-dev",
        "zenstruck/form-bundle": "dev-master",
        "stephanecollot/datetimepicker-bundle": "dev-master"

    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard\\Composer::hookRootPackageInstall"
        ],
        "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::removeSymfonyStandardFiles"
        ],
        "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::removeSymfonyStandardFiles"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "symfony-assets-install":"symlink",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.7-dev"
        }
    }
}
  • 写回答

1条回答 默认 最新

  • doukundong9652 2015-12-08 13:43
    关注

    I was facing exactly the same problem today with a slightly different composer.json file. The problem seems to be in the SonataDoctrineORMAdminBundle and has obviously been fixed in this commit.

    Changing the dependency of sonata-project/doctrine-orm-admin-bundle from ~2.2 to dev-master#82c9fc21836436d3bdd952ad8780862c79f48707 fixed the issue for me and may solve your problem too.

    So these are my dependencies now:

    "sonata-project/block-bundle": "~2.3@dev",
    "sonata-project/admin-bundle": "~2.3@dev",
    "sonata-project/doctrine-orm-admin-bundle": "dev-master#82c9fc21836436d3bdd952ad8780862c79f48707",
    

    Note: This should only be a temporary fix until the corresponding pull request has been merged.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名