Symfony 2 : 清除缓存时出错


Symfony 2 : Error when cache clear

执行此命令时出现错误:

php app/console cache:clear --env=prod && php app/console cache:clear --env=dev && php app/console assets:install --symlink && php app/console assetic:dump

错误是:

[Symfony''Component''Debug''Exception''ContextErrorException] Catchable 致命错误:参数 1 传递给 Sonata''AdminBundle''Security''Handler''RoleSecurityHandler::__construct() 必须实现接口 Symfony''Component''Security''Core''SecurityContextInter face, null 给定,调用 /opt/preprod/app/cache/pro_/ap_ProdProjectContainer.php 在第 1923 行 并定义

你能帮忙我真的不知道如何解决这个问题吗

编辑

我尝试备份

作曲家.锁

供应商

目录(然后删除它们)。然后我删除了每年的缓存。然后我做了一个作曲家安装,但当我安装作曲家时,错误又回来了。

Sensio'Bundle'DistributionBundle'Composer'ScriptHandler::clearCache

  [Symfony'Component'Debug'Exception'ContextErrorException]                                                                                                                                          
  Catchable Fatal Error: Argument 1 passed to Sonata'AdminBundle'Security'Handler'RoleSecurityHandler::__construct() must implement interface Symfony'Component'Security'Core'SecurityContextInterface, null given, called in /opt/preprod/app/cache/dev/appDevDebugProjectContainer.php on line 4984 and defined

Script Sensio'Bundle'DistributionBundle'Composer'ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

  [RuntimeException]
  An error occurred when executing the "'cache:clear --no-warmup'" command.

PHP应用程序/检查.php给我一切都好

所以我找不到解决这个问题的方法

你使用的是哪个版本的Symfony?我猜是2.8或3.0,因为它看起来SonataAdminBundle的版本与您的Symfony版本不兼容。