简体   繁体   English

服务“ form.type.users”依赖于不存在的服务“ security.context”

[英]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.

相关问题 服务“ twig”依赖于不存在的服务“ security.context” - The service “twig” has a dependency on a non-existent service “security.context” 您已请求不存在的服务“security.context” - You have requested a non-existent service “security.context” 服务“ security.context_listener.0”依赖于不存在的服务“ fos_user.user_manager” - The service “security.context_listener.0” has a dependency on a non-existent service “fos_user.user_manager” Symfony 3.2“security.firewall.map.context.main”依赖于不存在的服务^我的身份验证处理程序^ - Symfony 3.2 “security.firewall.map.context.main” has a dependency on a non-existent service ^my authentication handler^ 服务“sonata.block.service.container”依赖于不存在的服务“模板化” - The service “sonata.block.service.container” has a dependency on a non-existent service “templating” Symfony2错误:服务“模板”依赖于不存在的服务“ templating.globals” - Symfony2 error: The service “templating” has a dependency on a non-existent service “templating.globals” Symfony:服务...依赖于不存在的参数kernel.secret - Symfony: The service … has a dependency on a non-existent parameter kernel.secret Symfony突然失败,“服务”session.storage.metadata_bag“依赖于不存在的参数” - Symfony is suddenly failing with “The service ”session.storage.metadata_bag“ has a dependency on a non-existent parameter” 奏鸣曲管理员:不存在的服务“security.authorization_checker” - Sonata Admin: non-existent service "security.authorization_checker" ServiceNotFoundException:服务“ my.facebook.user”具有对不存在的服务“ fos_user.user_manager”的依赖 - ServiceNotFoundException: The service “my.facebook.user” has a dependency on a non-existent service “fos_user.user_manager”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM