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

问题描述 投票:0回答:1

我在我的项目symfony2.8中使用过。我这样配置了config.yml

fos_user:

db_driver:orm

firewall_name:main

user_class:Video \ IntelligenceBundle \ Entity \ Users

FROM_EMAIL:

    address: [email protected]

    sender_name: example

parameter.yml这样:

参数:

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: [email protected]

mailer_password: test

database_user: root

database_password: null

但是当我运行这个命令时:

php app/console doctrine:schema:update --force

我收到此错误:

 The service "form.type.users" has a dependency on a non-existent service "security.context".

服务:

form.type.users:

    class: Video\IntelligenceBundle\Form\UsersType

    arguments: ["@security.context"]

    tags:

        - { name: form.type, alias: users_type }
php symfony security console doctrine
1个回答
0
投票

查看https://symfony.com/blog/new-in-symfony-2-6-security-component-improvements上的升级说明 - 自Symfony 2.6以来该服务已被弃用,您需要检查哪些部分(令牌存储服务security.token_storage允许您访问当前登录的用户,或服务security.authorization_checker以检查权限) )实际上需要你的形式。

但是如果你使用Symfony 2.8,这不应该是一个阻止者:你确定你真的使用的是那个版本而不是更新版本吗?然而,将代码重构为这些新服务应该没有错

© www.soinside.com 2019 - 2024. All rights reserved.