php - FosuserBundle(路径 "fos_user.from_email.address"不能包含空值,但为空。)

标签 php symfony bundle sonata-admin

我在安装 FOsuserbundle 时遇到问题。这是我的结果问题:

这是我的config.yml:

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AppBundle\Entity\User
    from_email:
        address: "%mailer_user%"
        sender_name: "%mailer_user%"

安全性:

# http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
    in_memory:
        memory: ~

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    main:
        anonymous: ~
        # activate different ways to authenticate

        # http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
        #http_basic: ~

        # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
        #form_login: ~
encoders:
    FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            csrf_token_generator: security.csrf.token_manager
            # if you are using Symfony < 2.8, use the following config instead:
            # csrf_provider: form.csrf_provider

        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }

这是我的 routing.yml:

fos_用户: 资源:“@FOSUserBundle/Resources/config/routing/all.xml”

最佳答案

问题出在您的 parameters.yml 文件上:

parameters:
    ...
    mailer_user: null
    mailer_password: null

将其更改为其他内容,您将不会收到错误。

关于php - FosuserBundle(路径 "fos_user.from_email.address"不能包含空值,但为空。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43723529/

相关文章:

php - MySQL:更新所有行将字段设置为 0,但将一行的字段设置为 1

php - 如何在 symfony2 上添加自定义异常

php - 交响乐 : preg_match() expecting parameter

symfony - 我为什么要制作 bundle ? (交响乐2)

php - PHP 脚本运行 90 秒后内部服务器错误 500

phpmyadmin 没有登录页面,很多乱码(ubuntu 16),php7.0

php - 287 不是有效的 cURL 句柄资源

database - symfony2 doctrine.dbal.connection_factory 与 ssl?

android - 为屏幕方向保存我的 ListView 的状态

css - 在 Release模式下找不到字体和图像