简体   繁体   中英

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

I used in my project symfony2.8. I configured config.yml like that:

fos_user:

db_driver: orm

firewall_name: main

user_class: Video\\IntelligenceBundle\\Entity\\Users

from_email:

    address: you@example.com

    sender_name: example

and parameter.yml like that:

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.

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? Nevertheless, it should not be wrong to refactor your code to these new services

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM