【问题标题】:Symfony Cron library failed on Doctrine DBAL errorSymfony Cron 库因 Doctrine DBAL 错误而失败
【发布时间】:2021-12-07 13:27:00
【问题描述】:

我在我的 Symfony 项目中使用这个 cron library。它今天还在工作,在从头开始重新创建所有内容(docker、数据库、供应商文件夹)并再次运行它之后,它崩溃了。

正如文档中所说,我能够发出特定的命令并将它们保存在数据库中。

但是在运行bin/console cron:start --blocking 时会抛出:

在 Manager.php 第 60 行:

试图调用类的名为“ping”的未定义方法 “学说\DBAL\连接”。

在我的日志文件中:

console.ERROR: Error thrown while running command "cron:start --blocking". Message: "Call to undefined method Doctrine\DBAL\Connection::ping()" {"exception":"[object] (Error(code: 0): Call to undefined method Doctrine\\DBAL\\Connection::ping() at /app/vendor/cron/cron-bundle/Cron/Manager.php:60)","command":"cron:start --blocking","message":"Call to undefined method Doctrine\\DBAL\\Connection::ping()"} []

【问题讨论】:

    标签: php symfony


    【解决方案1】:

    您使用的包与doctrine/dbal >= 3 不兼容。

    您可以将其发送到您的composer.json 并重新安装,以便您的项目使用 DBAL 2:

    "conflict": {
        "doctrine/dbal": "^3.0"
      },
    

    当然,这取决于您是否需要 DBAL 3。

    尽管坦率地说,我会停止使用Cron/Symfony-Bundle。似乎完全没有必要。只需将您的 cronjob 任务直接添加到您的 crontab。捆绑包并没有让你从编辑 crontab 中解放出来,所以你不妨把你的任务放在那里。

    【讨论】:

      猜你喜欢
      • 2013-07-15
      • 2018-03-09
      • 1970-01-01
      • 2018-12-18
      • 1970-01-01
      • 2014-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多