Symfony FOS用户包启动

时间:2017-02-07 17:46:09

标签: php symfony fosuserbundle

我在安装FOS用户包时遇到问题。我试图在任何地方搜索它,但可能我太笨了,无法找到它。

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

这是我的config.yml fos part。

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

有什么建议吗?

2 个答案:

答案 0 :(得分:52)

在你的config.yml中添加from_email在路径" 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

答案 1 :(得分:0)

在您的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"