SonataAdminBundle 缺少 form.type_extension.csrf.enabled 参数

Missing form.type_extension.csrf.enabled parameter with SonataAdminBundle

我正在关注 SonataAdminBundle 文档,所以我已经安装了 Bundle 并将它们添加到 AppKernel 中,现在我陷入了配置。 我已经使用了基本配置,但我一直收到此错误:

The service "sonata.admin.builder.orm_datagrid" has a dependency on a non-existent parameter "form.type_extension.csrf.enabled".

我不知道这个参数是什么,也不知道如何正确设置它。

在你的 app/config/yml 你应该有这样一行:

framework:
    #csrf_protection: ~

确保它没有被评论:

framework:
    csrf_protection: ~