fixed: CakeFixtureManager::_setupTable() is called outside of transaction

Fixed PDOException thrown with the message "There is no active transaction" in PHP 8.0+.
SQL like CREATE/DROP/TRUNCATE TABLE implicitly commits just before.
In PHP 8.0+, calling commit/rollback afterwards will now throw a PDOException.
This commit is contained in:
Koji Tanaka 2022-12-28 18:47:07 +09:00 committed by Kamil Wylegala
parent b1229c9107
commit 5ae08a4dba

View file

@ -229,8 +229,8 @@ class CakeFixtureManager {
if (!empty($this->_loaded[$f])) { if (!empty($this->_loaded[$f])) {
$fixture = $this->_loaded[$f]; $fixture = $this->_loaded[$f];
$db = ConnectionManager::getDataSource($fixture->useDbConfig); $db = ConnectionManager::getDataSource($fixture->useDbConfig);
$db->begin();
$this->_setupTable($fixture, $db, $test->dropTables); $this->_setupTable($fixture, $db, $test->dropTables);
$db->begin();
$fixture->insert($db); $fixture->insert($db);
$db->commit(); $db->commit();
} }