【问题标题】:Symfony FOS user bundle initiationSymfony FOS 用户包启动
【发布时间】:2017-02-07 17:46:08
【问题描述】:

我在安装 FOS 用户包时遇到问题。我试着到处搜索它,但可能是我太笨了,找不到它。

我创建了一个名为 Admin 的实体并尝试运行教义:schema:update --force 我有一个错误:The child node "from_email" at path "fos_user" must be configured.

这是我的 config.yml fos 部分。

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\Entity\Admin

有什么建议吗?

【问题讨论】:

  • 以前看过这个问题,但没有找到解决方案:(我尝试将节点“from_email”与节点“地址”和“名称”与来自 fos 文档的值添加,但它仍然没有不行。
  • 添加配置后的配置如何?你当时遇到了什么错误?
  • 必须配置路径“fos_user”的子节点“from_email”。

标签: php symfony fosuserbundle


【解决方案1】:

在您的 config.yml 中添加 from_email at path "fos_user":

# ...
fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\Entity\Admin
    # ...
    from_email:
        address: you@example.com
        sender_name: You
# ...

更多信息:Step 5: Configure the FOSUserBundle

【讨论】:

  • 哇,谢谢。我在 fos 上使用推荐的 dev-master 分支,当我看到红线消息时进入恐慌模式...
【解决方案2】:

在您的 config.yml 中,在路径“fos_user”处添加 from_email:

fos_user:
  db_driver:      orm # can be orm or odm
  firewall_name:  main
  user_class:     Sonata\UserBundle\Entity\BaseUser
  from_email:
    address: "%mailer_host%"
    sender_name: "%mailer_user%"

然后您从 parameters.yml 文件中获取这些值

# This file is auto-generated during the composer install
parameters:

    mailer_host: 127.0.0.1
    mailer_user: "mailer_user"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-12
    • 2017-05-26
    • 2014-07-14
    相关资源
    最近更新 更多