2

sonataUserBundle と fosUserBundle を設定しようとしています。プロフィール ページにアクセスしようとすると、次のエラーが発生しました。

    Attempted to call an undefined method named "setCurrentUri" of class "Knp\Menu\MenuItem".
Did you mean to call "setCurrent"? 

私の composer.json には、このバージョンの "knplabs/knp-menu-bundle": "~2.0" があります。

バージョン "knplabs/knp-menu-bundle": "~1.1" にダウングレードしました。しかし、作曲家を更新しようとすると、次のようなエラーが発生しました。

Problem 1
    - sonata-project/admin-bundle 2.4.x-dev requires knplabs/knp-menu-bundle >=2
.0,<3.0.0 -> no matching package found.
    - sonata-project/admin-bundle 2.4.x-dev requires knplabs/knp-menu >=2.0,<3.0
 -> no matching package found.
    - Installation request for sonata-project/admin-bundle ~2.4@dev -> satisfiab
le by sonata-project/admin-bundle[2.4.x-dev].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your min
imum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further commo
n problems.

誰かがこのエラーを解決する方法を知っていますか?

メソッド setCurrentUri の呼び出しが Symfony/SonataUserBundle セットアップで失敗する

ありがとうございました

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

    },
    "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",

        "sonata-project/user-bundle": "2.2.4",
        "sonata-project/core-bundle":  "~2.3@dev,>=2.3.1",
        "sonata-project/block-bundle": "~2.3@dev",
        "sonata-project/page-bundle": "~2.3",
        "symfony-cmf/routing-bundle": "~1.1",
        "knplabs/knp-menu-bundle":  "~2.0",
        "sonata-project/admin-bundle": "~2.4@dev",
        "sonata-project/doctrine-orm-admin-bundle":  "~2.4@dev",
        "sonata-project/easy-extends-bundle": "~2.1"

    },
    "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"
        }
    }
}
4

2 に答える 2

2

KnpMenu と SonataBlockBlockBundle のバージョンを使用していますか? composer.json を確認してください。

setCurrentUri メソッドは KnpMenu v. 2.0 で非推奨になりました。SonataBlockBundle の composer.json は、開発インストール以外では KnpMenu を必要としません。そのため、Sonata バンドルでまだサポートされていない新しいバージョンの knplabs/knp-menu-bundle が必要になる可能性があります。

1.1.x で knplabs/knp-menu-bundle を要求してみてください:

{
...
"require": {
    "knplabs/knp-menu-bundle": "~1.1"
},
...
}
于 2015-09-23T15:17:10.300 に答える