刚进入 Symfony2,我想使用 CMF 包。
我在这里关注食谱:http: //symfony.com/doc/current/cmf/cookbook/editions/cmf_core.html
跑步时
composer.phar update
我收到此错误:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
When the dynamic router is enabled, you need to either enable one of the persistence layers or set the cmf_routing.dynamic.route_provider_service_id option
route_provider_service_id 的正确设置是什么?我找不到任何关于此的文档。
配置.yml
# CMF config
cmf_routing:
chain:
routers_by_id:
cmf_routing.dynamic_router: 200
router.default: 100
dynamic:
enabled: true
route_provider_service_id: ~
sonata_block:
default_contexts: [cms]
这是我的 composer.json 文件:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"minimum-stability": "dev",
"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",
"jackalope/jackalope-doctrine-dbal": "dev-master",
"doctrine/phpcr-bundle": "1.0.*",
"doctrine/phpcr-odm": "1.0.*",
"symfony-cmf/symfony-cmf": "1.0.*"
},
"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"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
}
}
}
如果有人能对这些 cmf_routing 设置有所了解,以便从 composer 获得干净的更新,那就太好了。
我发现对这种新的 Sym2 方法感到沮丧的一件事是,您需要的每个包似乎都带有另一个必需的包,编译错误和混淆的概率。
更新
我在这里查看了动态配置:http: //symfony.com/doc/master/cmf/reference/configuration/routing.html#dynamic
它是关于 route_provider_service_id 的:
route_provider_service_id
类型:字符串
当没有启用任何持久层时,必须提供路由提供者服务才能获取路由。这是通过使用 route_provider_service_id 设置完成的。
我知道如果我不设置持久性,我应该添加这个设置。我知道设置应该是一个字符串。但我不知道 service_id 实际上是什么,所以我不知道设置可能是什么。也许我仍然不清楚我在用动态路由器做什么。
我可以通过启用 persistence.phpcr 并给出 manager_name: null 来解决这个问题
删除了错误,但定义 manager_name 可能是使 CMF 启动的重要步骤。