FOSUser在Symfony 3.3上 [英] FOSUser on Symfony 3.3

查看:86
本文介绍了FOSUser在Symfony 3.3上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这类似于 Symfony3您已请求不存在的服务"validator.builder",同时在香草Symfon3.3而不是微内核上添加了FOSUserBundle (如果有所不同).

This is similar to Symfony3 You have requested a non-existent service "validator.builder", while add FOSUserBundle, on vanilla Symfon3.3 instead of microkernel (in case that makes differences).

我在尝试在Symfony 3.3上设置FOSUser(v.2)时遇到问题:

I have a problem trying to set up FOSUser (v.2) on a Symfony 3.3:

[Symfony\Component\DependencyInjection\Exception\AutowiringFailedException]
Cannot autowire service "validator.builder": argument "$node" of method
"Symfony\Component\Config\Definition\Builder\ValidationBuilder::__construct()"
references class Symfony\Component\Config\Definition\Builder\NodeDefinition"
but no such service exists.

通过在线API浏览:

  • ValidationBuilder is marked up to the 3.2 branch, although exists in github
  • NodeDefinition is also marked up to v3.2, although exists in github

这是否意味着他们的文档不是最新的master 3.3版本?

Does that mean that their documentation is not up to date with the master 3.3?

还是不再维护?

官方文档之后,我首先遇到了以下问题:

Following the official documentation, I first faced these problems:

  1. mailer_user不能为null;通过编辑parameters.yml解决: 参数: mailer_user:"me@example.com"
  2. non-existent-service-validator-builder ;通过声明服务validator.builder
  3. 解决
  4. 不存在的参数内核密码;通过在parameters.yml中复制一行来解决:

  1. mailer_user cannot be null ; solved by editing parameters.yml: parameters: mailer_user: "me@example.com"
  2. non-existent-service-validator-builder ; solved by declaring service validator.builder
  3. non existent parameter kernel secret ; solved by duplicating a line in parameters.yml:

parameters:
    secret: <-generated-upon-install->
    kernel.secret: <-duplicated-line->

我想,如果有人遇到过,有一种很好而聪明的方法可以解决这个问题?

I suppose there is a nice and clever way to get out of this problem, if anyone faced it yet?

推荐答案

已解决!在service.yml中,请勿将service声明为

Solved! In service.yml, do not declare service as

validator.builder:
    class: Symfony\Component\Config\Definition\Builder\ValidationBuilder

但是这种方式:

Symfony\Component\Config\Definition\Builder\ValidationBuilder:
    autowire: true

再次,官方文档有了答案!

这篇关于FOSUser在Symfony 3.3上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆