编译错误:validateBlock()声明必须与Symfony2 Sonata项目中的Blockadmin兼容

时间:2016-01-31 19:03:56

标签: symfony sonata-admin sonata

将页面包添加到formarly正在运行的Symfony2项目后,我收到以下错误。

  

[Symfony的\元器件\调试\异常\ FatalErrorException]

Compile Error: Declaration of Sonata\PageBundle\Block\ChildrenPagesBlockServic  
  e::validateBlock() must be compatible with Sonata\BlockBundle\Block\BlockAdmin  
  ServiceInterface::validateBlock(Sonata\CoreBundle\Validator\ErrorElement $erro  
  rElement, Sonata\BlockBundle\Model\BlockInterface $block)   

My Composer.json如下。

        "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",
        "sonata-project/core-bundle": "^2.3",
        "knplabs/knp-menu-bundle": "dev-master",

        "sonata-project/admin-bundle": "dev-master",
        "sonata-project/doctrine-orm-admin-bundle": "dev-master",
        "sonata-project/easy-extends-bundle": "^2.1",
        "sonata-project/seo-bundle": "~1.1",
        "sonata-project/notification-bundle": "^2.3",
        "sonata-project/cache-bundle": "^2.2",
        "sonata-project/datagrid-bundle": "2.2.*@dev",
        "sonata-project/page-bundle": "^2.3",
        "sonata-project/block-bundle": "^2.3"

提前致谢...

1 个答案:

答案 0 :(得分:0)

不得不降级几个软件包,使页面包与admin-bundle和block bundle兼容。

"require": {

        "sonata-project/admin-bundle": "2.3.*",
        "sonata-project/doctrine-orm-admin-bundle": "~2.3",
        "sonata-project/page-bundle": "^2.3",
        "sonata-project/block-bundle": "2.2.*"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3",

    },