security.yml中的异常,因为意外的':'

时间:2016-12-18 11:06:14

标签: php symfony

我是symfony的新手,现在我得到了一个例外:

  

路由文件“/Users/alex/myProjectName/src/Custom/CMSBundle/Resources/config/routing.yml”包含“logout”:“pattern”不支持的密钥。预期的一个:“资源”,“类型”,“前缀”,“路径”,“主机”,“方案”,“方法”,“默认值”,“要求”,“选项”,“条件”/用户/alex/myProjectName/src/Custom/CMSBundle/Resources/config/routing.yml(从“/Users/alex/myProjectName/app/config/routing.yml”导入)。

在线短信说这条线不正确:

  

在第18行第24列扫描一个普通标量时发现了意外的':':   USER_DB:         entity:{class:CustomCMSBundle:User,property:username}

    security:
      encoders:
        Symfony\Component\Security\Core\User: plaintext
        Custom\CMSBundle\Entity\User: bcrypt
      role_hierarchy:
        ROLE_ADMIN: [ROLE_USER]
      providers:
        chain_provider:
          chain:
            providers: [in_memory, user_db]
        in_memory:
          memory:
            users:
              admin: { password: adminpass, roles: ROLE_ADMIN }
        user_db:
          entity: { class: CustomCMSBundle:User, property: username }
      firewalls:
        main:
          pattern: /.*
          form_login:
            login_path: /login
            check_path: /login_check
            default_target_path: /
          logout:
            path: /logout
            target: /
          security: true
          anonymous: true
      access_control:
        - { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: /cms/user, roles: ROLE_ADMIN }
        - { path: /.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }

1 个答案:

答案 0 :(得分:0)

也许试试

    user_db:
      entity: { class: Custom\CMSBundle\Entity\User, property: username }

而不是

    user_db:
      entity: { class: CustomCMSBundle:User, property: username }