【问题标题】:Symfony 2 : Error when cache clearSymfony 2:缓存清除时出错
【发布时间】:2016-05-09 00:15:43
【问题描述】:

执行此命令时出现错误:

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] 可捕获 致命错误:参数 1 传递给 Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct() 必须实现接口 Symfony\Component\Security\Core\SecurityContextInterface,null 给定的,调用的 /opt/preprod/app/cache/pro_/ap_ProdProjectContainer.php 第 1923 行 并定义

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

编辑

我尝试备份

composer.lock

供应商

目录(然后删除它们)。然后我手动删除了缓存。 然后我安装了作曲家,但是当我安装作曲家时错误又回来了。

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 app/check.php 给我一切都好

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

【问题讨论】:

  • 您是否尝试使用rm -rf app/cache/* 删除缓存?
  • 您应该先手动清除缓存,然后将每个命令的结果单独发布,以便我们帮助您找到问题。它可能与供应商冲突有关,因此您可能需要备份供应商 (mv vendor vendor_bkp) 并运行 composer install。

标签: php symfony


【解决方案1】:

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

【讨论】:

  • 我在 Symfony 2.8+ 上使用 SonataAdminBundle 没有任何问题。
  • 是的,但是您使用的是什么版本的 SonataAdminBundle?此外,例如使用 SonataUserBundle,从 Symfony 2.7 升级到 Symfony 2.8 时需要执行一些手动步骤,因此可能是兼容性问题。
猜你喜欢
  • 2017-12-21
  • 1970-01-01
  • 2013-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-22
  • 2014-07-29
相关资源
最近更新 更多