[英]The service “form.type.users” has a dependency on a non-existent service “security.context”
I used in my project symfony2.8. 我在我的项目symfony2.8中使用了。 I configured
config.yml
like that: 我像这样配置
config.yml
:
fos_user: fos_user:
db_driver: orm db_driver:orm
firewall_name: main firewall_name:主要
user_class: Video\\IntelligenceBundle\\Entity\\Users user_class:视频\\ IntelligenceBundle \\ Entity \\ Users
from_email: from_email:
address: you@example.com
sender_name: example
and parameter.yml
like that: 和
parameter.yml
这样的:
parameters: 参数:
mongodb_server: "mongodb://xxx.xxx.xxx.xxx:xxxx"
database_host: xxx.xxx.xxx.xxx
database_port: xxxx
database_name: dbtest
mailer_transport: smtp
mailer_host: mail.supremecenter.com
mailer_user: test@example.pro
mailer_password: test
database_user: root
database_password: null
But when I run this command: 但是当我运行此命令时:
php app/console doctrine:schema:update --force
I get this error: 我收到此错误:
The service "form.type.users" has a dependency on a non-existent service "security.context".
services: 服务:
form.type.users:
class: Video\IntelligenceBundle\Form\UsersType
arguments: ["@security.context"]
tags:
- { name: form.type, alias: users_type }
Have a look at the upgrade notes at https://symfony.com/blog/new-in-symfony-2-6-security-component-improvements - that service has been deprecated since Symfony 2.6 and you need to check which parts (either the token storage service security.token_storage
giving you access to the currently logged in user, or the service security.authorization_checker
to check for permissions) are actually needed in your form. 请参阅https://symfony.com/blog/new-in-symfony-2-6-security-component-improvements中的升级说明-自Symfony 2.6起该服务已被弃用,您需要检查哪些部分(在您的表单中实际上需要令牌存储服务
security.token_storage
使您可以访问当前登录的用户),或者服务security.authorization_checker
来检查权限)。
But as this should not be a blocker if you are using Symfony 2.8: are you sure that you are really using that version and not a more recent one? 但是,如果您使用的是Symfony 2.8,那么这应该不会成为阻碍:您确定您确实使用的是该版本,而不是较新的版本? Nevertheless, it should not be wrong to refactor your code to these new services
但是,将代码重构为这些新服务应该没有错。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.