[英]Symfony2: User Login from Database - Error in security.yml
I need to log in a user with credentials from the database. 我需要使用数据库中的凭据登录用户。 However, an error is generated when defining the provider in security.yml.
但是,在security.yml中定义提供程序时会生成错误。
Here is the error: 这是错误:
InvalidConfigurationException: Unrecognized options "class, property" under "security.providers.myapp_entity_admin.users.entity"
In the providers section in security.yml I have the following: 在security.yml的提供程序部分中,我具有以下内容:
providers:
myapp_entity_admin:
users:
entity: { class: MyApp\MainBundle\Entity\User, property: username }
The question is why Symfony would throw the above error. 问题是,Symfony为什么会抛出上述错误。 Official documentation seems to indicate that this is correct.
官方文件似乎表明这是正确的。
Thanks, 谢谢,
JB JB
Well, it looks like I threw in too many parameters. 好吧,好像我输入了太多参数。 The code in security.yml should look like this:
security.yml中的代码应如下所示:
providers:
myapp_entity_admin:
entity: { class: MyApp\MainBundle\Entity\User, property: username }
I think that, because yml files are parsed by indentation, you need to indent "myapp_entity_admin". 我认为,因为yml文件是通过缩进进行解析的,所以您需要缩进“ myapp_entity_admin”。 Right now it's on the same level as "providers" which is not what you want.
现在,它与“提供者”处于同一级别,这不是您想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.