I am using this cron library within my Symfony project. It was working today and after recreating everything from the start (docker, database, vendor folder) and running it again, it crashes.
As it says in documentation I was able to make specific commands and they are persisted in the database.
However when running bin/console cron:start --blocking
it throws:
In Manager.php line 60:
Attempted to call an undefined method named “ping” of class “DoctrineDBALConnection”.
And in my log file:
console.ERROR: Error thrown while running command "cron:start --blocking". Message: "Call to undefined method DoctrineDBALConnection::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()"} []
Advertisement
Answer
The package you are using is not compatible with doctrine/dbal >= 3.
You can this to your composer.json
and reinstall, so that your project uses DBAL 2:
"conflict": { "doctrine/dbal": "^3.0" },
Of course, this would depend on you not needing DBAL 3 for anything else.
Although, frankly, I would stop using the Cron/Symfony-Bundle
. Seems completely unnecessary. Just add your cronjob tasks directly to your crontab. It’s not like the bundle frees you from editing crontab, so you might as well put your tasks there.