Closed PapyDanone closed 3 years ago
Actually using TransactionHelper
in Doctrine\ORM\EntityManager
fixes the issue:
line 237:
public function transactional($func)
{
if (! is_callable($func)) {
throw new InvalidArgumentException('Expected argument of type "callable", got "' . gettype($func) . '"');
}
$this->conn->beginTransaction();
try {
$return = call_user_func($func, $this);
$this->flush();
// $this->conn->commit();
TransactionHelper::commitIfInTransaction($this->conn);
return $return ?: true;
} catch (Throwable $e) {
$this->close();
// $this->conn->rollBack();
TransactionHelper::rollbackIfInTransaction($this->conn);
throw $e;
}
}
Do you know if any DDL statements are executed before the attempt to commit? The issues you are linking to should only arise when combining PHP 8 + PDO + MySQL or Oracle + DDL statements.
Maybe that's because of the "purging database" step? Does it maybe work with DROP
+ CREATE TABLE
?
@greg0ire thanks for putting me on the right track. One of the fixture files contained an ALTER TABLE
statement which caused the issue.
Most likely related to https://github.com/doctrine/migrations/issues/1104 and https://github.com/doctrine/migrations/issues/1139
Versions installed:
To reproduce:
bin/console doctrine:fixtures:load --verbose
Stack trace:
Possible resolution:
I haven't had the time too look into this in details but since this happens in a Rollback, the solution may be similar to https://github.com/doctrine/migrations/pull/1143
Thank you for the help, and please let me know how I can help further.