SonataBlock、SonataAdmin 和其他 Sonata 包不断显示 "Validation" 错误

SonataBlock, SonataAdmin and Other Sonata bundles keep showing "Validation" error

编译错误:Sonata\FormatterBundle\Block\FormatterBlockService::validateBlock() 的声明必须与 Sonata\BlockBundle\Block\BlockAdminServiceInterface::validateBlock(Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\BlockBundle\Model\BlockInterface $block)

同时:

PHP 致命错误:Sonata\AdminBundle\Block\AdminListBlockService::validateBlock() 的声明必须与 Sonata\BlockBundle\Block\BlockServiceInterface::validateBlock(Sonata\AdminBundle\Validator\ErrorElement $errorElement, Sonata\BlockBundle\Model\BlockInterface $block) 在 /phpProjects/vendor/sonata-project/admin-bundle/Block/AdminListBlockService.php 第 105

这是我的composer.json

    "php": ">=5.4",
    "symfony/symfony": "2.6.*",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "~1.2",
    "twig/extensions": "~1.0",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~3.0",
    "sensio/framework-extra-bundle": "~3.0",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "~1.3@dev",
    "knplabs/knp-menu-bundle": "1.1.*@dev",
    "sonata-project/core-bundle": "~2.2@dev",
    "sonata-project/intl-bundle": "~2.2",
    "sonata-project/cache-bundle": "~2.2@dev",
    "sonata-project/easy-extends-bundle": "~2.1",
    "sonata-project/admin-bundle": "~2.3@dev",
    "sonata-project/doctrine-orm-admin-bundle": "~2.3@dev",
    "sonata-project/block-bundle": "~2.2",
    "sonata-project/exporter": "1.*",
    "sonata-project/user-bundle": "~2.3@dev",
    "sonata-project/formatter-bundle": "~2.3",
    "sonata-project/datagrid-bundle": "~2.2@dev",
    "sonata-project/media-bundle": "~2.3@dev",
    "jms/serializer-bundle": "~0.11",
    "jms/security-extra-bundle": "~1.5@dev",
    "jms/di-extra-bundle": "~1.4@dev",
    "jms/translation-bundle": "1.1.*@dev",
    "friendsofsymfony/jsrouting-bundle": "~1.1",
    "genemu/form-bundle": "2.2.*@dev",
    "wbx/file-bundle": "dev-master",

同样的问题。 "sonata-project/admin-bundle": "~2.3@dev" 在过去 2 天内似乎发生了一些变化,现在它失败了(此设置在 2 天前工作)。我回滚到正在运行的奏鸣曲 2.2。我建议在 github.

上创建一个问题


编辑: 今天我不得不将奏鸣曲更改为最新版本。此设置也有效:

"sonata-project/core-bundle": "dev-master",
"sonata-project/block-bundle": "dev-master",
"sonata-project/admin-bundle": "dev-master",
"sonata-project/easy-extends-bundle": "dev-master",
"sonata-project/jquery-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",

昨天我遇到了同样的问题,应该与昨天早上的更新有关,今天我更改了 composer.json 这是我的工作配置:

"sonata-project/core-bundle": "2.3.*@dev",
"sonata-project/admin-bundle": "2.4.*@dev",
"sonata-project/user-bundle": "2.3.*@dev",
"sonata-project/doctrine-mongodb-admin-bundle": "2.3.*@dev",
"sonata-project/easy-extends-bundle": "2.1.*@dev",
"sonata-project/block-bundle": "2.3.*@dev",
"sonata-project/doctrine-orm-admin-bundle": "2.3.*@dev",
"sonata-project/cache-bundle": "~2.2@dev",
"sonata-project/seo-bundle": "2.0.*@dev",
"sonata-project/notification-bundle": "~2.3@dev",
"symfony-cmf/routing-bundle": "~1.4@dev",
"sonata-project/page-bundle": "2.4.*@dev",
"sonata-project/datagrid-bundle": "2.2.*@dev"

最佳方案,添加依赖只能直接使用

我写到下面

    "friendsofsymfony/user-bundle": "~1.3",
    "sonata-project/user-bundle": "3.0.1",
    "sonata-project/cache-bundle": "~2.2@dev",
    "sonata-project/intl-bundle": "~2.2",
    "sonata-project/doctrine-orm-admin-bundle": "3.0.1",
    "sonata-project/doctrine-mongodb-admin-bundle": "3.0.0"

SonataAdminBundle 是 SonataUserBundle 的依赖项。删除 SonataAdminBundle 并让 SonataUserBundle 安装包。其他都一样...

这是最好的解决方案。

我也遇到了同样的问题,我是这样解决的

    "php": "^5.3.9|^7.0",
    "symfony/symfony": "~2.8",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "doctrine/data-fixtures": "^1.1",
    "doctrine/doctrine-cache-bundle": "~1.0",
    "twig/extensions": "~1.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "symfony-cmf/symfony-cmf": "1.3.*",
    "symfony-cmf/simple-cms-bundle": "^1.3",
    "symfony-cmf/create-bundle": "1.2.*",
    "jackalope/jackalope-doctrine-dbal": "~1.1",
    "nelmio/alice": "~1.0",
    "symfony-cmf/routing-auto-bundle": "^1.1",
    "symfony/security-acl": "^3.0",
    "sonata-project/admin-bundle": "~2.3@dev",
    "sensio/generator-bundle": "~2.3",
    "sonata-project/doctrine-phpcr-admin-bundle": "^1.2.6",
    "symfony-cmf/menu-bundle": "^2.0"

目前,它正在运行。