![](/img/trans.png)
[英]The service “twig” has a dependency on a non-existent service “security.context”
[英]The service “form.type.users” has a dependency on a non-existent service “security.context”
我在我的項目symfony2.8中使用了。 我像這樣配置config.yml
:
fos_user:
db_driver:orm
firewall_name:主要
user_class:視頻\\ IntelligenceBundle \\ Entity \\ Users
from_email:
address: you@example.com
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: test@example.pro
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 }
請參閱https://symfony.com/blog/new-in-symfony-2-6-security-component-improvements中的升級說明-自Symfony 2.6起該服務已被棄用,您需要檢查哪些部分(在您的表單中實際上需要令牌存儲服務security.token_storage
使您可以訪問當前登錄的用戶),或者服務security.authorization_checker
來檢查權限)。
但是,如果您使用的是Symfony 2.8,那么這應該不會成為阻礙:您確定您確實使用的是該版本,而不是較新的版本? 但是,將代碼重構為這些新服務應該沒有錯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.