我在Symfony2创建Rest API和使用时遇到问题FOS\RestBundle
当我尝试生成数据库或实体时……无论我尝试生成什么,都会发生错误。
root@symfonyRest:/var/www/Symfony# php5 app/console doctrine:database:create
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options "prefer_extension" under "fos_rest.format_listener"
问题似乎出在config.yml
配置.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
#translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
[…]
sensio_framework_extra:
view: { annotations: false }
router: { annotations: true }
fos_rest:
format_listener:
prefer_extension: false
view:
view_response_listener: true
编辑 :
新的config.ymlformat_listener.rules
fos_rest:
view:
view_response_listener: true
format_listener:
rules:
prefer_extension: false
但我也有错误
[Symfony\Component\Config\Definition\Exception\InvalidTypeException]
Invalid type for path "fos_rest.format_listener.rules.prefer_extension". Ex
pected array, but got boolean
有人可以解决我的问题吗?谢谢 !