I use Symfony 2 and the FOSUserBundle. I can login, logout and view Profile.
我使用Symfony 2和FOSUserBundle。我可以登录,注销并查看个人资料。
Problem: When i go to "/register", fill out the form and press enter i get the following error:
问题:当我进入“/ register”时,填写表格并按回车键我收到以下错误:
You have requested a non-existent service "security.user_checker". 500 Internal Server Error - ServiceNotFoundException
您已请求不存在的服务“security.user_checker”。 500内部服务器错误 - ServiceNotFoundException
It seems that I have do to some additional configuration or so, but I can't find anything about it.
似乎我已经做了一些额外的配置,但我找不到任何关于它的东西。
Part of config.yml:
config.yml的一部分:
fos_user:
db_driver: orm
firewall_name: fos_user
user_class: Blogger\BlogBundle\Entity\User
security.yml:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
fos_user:
id: fos_user.user_manager
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
fos_user:
pattern: ^/
provider: fos_user
form_login:
check_path: /login_check
login_path: /login
logout:
path: /logout
target: /
anonymous: ~
access_control:
- { path: /secured/admin, roles: ROLE_ADMIN }
- { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
UPDATE
Stack trace:
3 个解决方案
#1
3
Make sure you specify a version for FOSUserBundle. The repository head is aligned with Symfony head, not 2.0.9.
确保为FOSUserBundle指定版本。存储库头与Symfony头对齐,而不是2.0.9。
[FOSUserBundle]
git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
target=/bundles/FOS/UserBundle
version=1.0.0
#2
1
If you're updating FOSUserBundle (or any bundle for that matter) you need to make sure you mimic changes made in the FOSUserBundle to any files you overwrite.
如果您要更新FOSUserBundle(或任何捆绑包),您需要确保模仿FOSUserBundle中对您覆盖的任何文件所做的更改。
In my particular case, in the RegistrationController FOSUserBundle changed a value from security.user_checker to fos_user.user_checker in the authenticateUser method, so I made the same change in my controller.
在我的特定情况下,在RegistrationController中,FOSUserBundle在authenticateUser方法中将security.user_checker中的值更改为fos_user.user_checker,因此我在控制器中进行了相同的更改。
Every time you do an update of the vendors, you need to make sure files (controllers, services etc) you're overwriting in your bundle are not depending on a service class or method that has been removed.
每次更新供应商时,都需要确保在捆绑中覆盖的文件(控制器,服务等)不依赖于已删除的服务类或方法。
#3
0
Do you register services right ? Or maybe You forgot add a routing for this service ?
你注册服务吗?或者您忘了为此服务添加路由?
#1
3
Make sure you specify a version for FOSUserBundle. The repository head is aligned with Symfony head, not 2.0.9.
确保为FOSUserBundle指定版本。存储库头与Symfony头对齐,而不是2.0.9。
[FOSUserBundle]
git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
target=/bundles/FOS/UserBundle
version=1.0.0
#2
1
If you're updating FOSUserBundle (or any bundle for that matter) you need to make sure you mimic changes made in the FOSUserBundle to any files you overwrite.
如果您要更新FOSUserBundle(或任何捆绑包),您需要确保模仿FOSUserBundle中对您覆盖的任何文件所做的更改。
In my particular case, in the RegistrationController FOSUserBundle changed a value from security.user_checker to fos_user.user_checker in the authenticateUser method, so I made the same change in my controller.
在我的特定情况下,在RegistrationController中,FOSUserBundle在authenticateUser方法中将security.user_checker中的值更改为fos_user.user_checker,因此我在控制器中进行了相同的更改。
Every time you do an update of the vendors, you need to make sure files (controllers, services etc) you're overwriting in your bundle are not depending on a service class or method that has been removed.
每次更新供应商时,都需要确保在捆绑中覆盖的文件(控制器,服务等)不依赖于已删除的服务类或方法。
#3
0
Do you register services right ? Or maybe You forgot add a routing for this service ?
你注册服务吗?或者您忘了为此服务添加路由?