在将 symfony 从 2.2 更新到 2.3 之后,我的所有页面和脚本中都出现了新的 stange 错误:
已弃用: Knp\Menu\Silex\Voter\RouteVoter 由于命名空间而被弃用,请改用 Knp\Menu\Matcher\Voter\RouteVoter。在第 20 行的 \vendor\knplabs\knp-menu\src\Knp\Menu\Silex\Voter\RouteVoter.php
和
已弃用: Knp\Menu\Silex\RoutingExtension 已弃用,请改用 Knp\Menu\Integration\Symfony\RoutingExtension。在第 15 行的 \vendor\knplabs\knp-menu\src\Knp\Menu\Silex\RoutingExtension.php
我该如何解决这个问题?我在网上找不到答案。
先感谢您
这是我的 composer.json :
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"incenteev/composer-parameter-handler": "~2.0",
"genemu/form-bundle": "2.1.*",
"jms/security-extra-bundle": "1.5.*",
"jms/di-extra-bundle": "1.4.*",
"phpunit/phpunit": "3.7.*",
"doctrine/data-fixtures": "@dev",
"friendsofsymfony/user-bundle": "~2.0@dev",
"stof/doctrine-extensions-bundle": "dev-master",
"knplabs/gaufrette": "0.2.*@dev",
"knplabs/knp-gaufrette-bundle": "dev-master",
"jms/serializer-bundle": "0.13.*@dev",
"amazonwebservices/aws-sdk-for-php": "dev-master",
"punkave/symfony2-file-uploader-bundle": "dev-master",
"oneup/uploader-bundle": "dev-master",
"knplabs/knp-paginator-bundle": "dev-master",
"jms/debugging-bundle": "dev-master",
"winzou/console-bundle": "dev-master",
"elao/web-profiler-extra-bundle" : "dev-master",
"cybernox/amazon-webservices-bundle": ">=1.5.4",
"genemu/form-bundle": "2.2.*",
"escapestudios/wsse-authentication-bundle": "2.3.x-dev",
"rezzza/flickr-bundle": "1.0.*@dev",
"knplabs/knp-menu-bundle": "dev-master",
"genemu/form-bundle": "2.1.*",
"leaseweb/api-caller-bundle": "*",
"eo/honeypot-bundle": "dev-master"
},
"scripts": {
"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"
],
"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"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
}
}
}
和我的菜单生成器:
namespace ...\Menu;
use Knp\Menu\Matcher\Matcher;
use Knp\Menu\MenuFactory;
use Knp\Menu\Renderer\ListRenderer;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(MenuFactory $factory, array $options)
{
$menu = $factory->createItem('root');
$menu->addChild('Dashboard', array(
'route' => 'dashboard' ));
$menu->addChild('Color Scheme', array(
'uri' => 'slidescheme' ));
$menu->addChild('Questionnnaires', array(
'uri' => 'questionnaire_manage' ));
// ... add more children
return $menu;
}
}