Ok, I found a solution by changing a vendor file: vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php
before:
public function execute($params = null)
{
try {
return parent::execute($params);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
after:
public function execute($params = null)
{
$tries = 1;
$maxTries = 3;
while(true) {
try {
return parent::execute($params);
} catch (\PDOException $exception) {
if($tries >= $maxTries)
throw new PDOException($exception);
$tries++;
}
}
}
However I am not sure how to implement this change in my own project without forking the package and the requiring the changed version (I would like to stick to the vendor package and somehow override just the single method)