在我的网站上一切正常,直到我决定添加我的composer.json那些行:
更新composer.json后我收到此错误:
CheckReferenceValidityPass.php第146行中的ScopeCrossingInjectionException:
检测到范围交叉注入:定义" sonata.admin.builder.orm_datagrid"引用服务" sonata.admin.builder.filter.factory"属于另一个范围层次结构。此服务可能无法始终可用。通常,移动定义" sonata.admin.builder.orm_datagrid"更安全。范围"原型",或声明"容器"作为"原型"的儿童范围。如果您可以确定其他范围始终处于活动状态,则可以将引用设置为strict = false以消除此错误。
我尝试了所有可以修复此错误的内容,但我仍然拥有它。我删除了我添加的所有新行,但仍然无法正常工作。
这是我的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"
}
}
}
答案 0 :(得分:0)
今天我遇到了完全相同的问题,文件略有不同composer.json
。问题似乎出现在SonataDoctrineORMAdminBundle中,并且显然已在this commit中修复。
将sonata-project / doctrine-orm-admin-bundle的依赖关系从~2.2
更改为dev-master#82c9fc21836436d3bdd952ad8780862c79f48707
为我解决了问题,也可以解决您的问题。
所以现在这些是我的依赖项:
"sonata-project/block-bundle": "~2.3@dev",
"sonata-project/admin-bundle": "~2.3@dev",
"sonata-project/doctrine-orm-admin-bundle": "dev-master#82c9fc21836436d3bdd952ad8780862c79f48707",
注意:在合并corresponding pull request之前,这只应该是临时修复。