Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary.
I've created a new method which checks if logs table exists, called in most cases only once. If the table exists, query CREATE TABLE... isn't called preventing transaction autocommit.
Todo: solution to prevent autocommit if table doesn't exist - first call of method createLogsTable() (when the table doesn't exist) still breaks transaction. See #25
Fix for: Fatal error: Declaration of MySQLHandler\MySQLHandler::write(array $record) must be compatible with Monolog\Handler\AbstractProcessingHandler::write(array $record): void in [...]\vendor\wazaari\monolog-mysql\src\MySQLHandler\MySQLHandler.php on line 164
1.
Source: https://www.php.net/manual/en/pdo.begintransaction.php
I've created a new method which checks if logs table exists, called in most cases only once. If the table exists, query
CREATE TABLE...
isn't called preventing transaction autocommit.Todo: solution to prevent autocommit if table doesn't exist - first call of method createLogsTable() (when the table doesn't exist) still breaks transaction. See #25
Fatal error: Declaration of MySQLHandler\MySQLHandler::write(array $record) must be compatible with Monolog\Handler\AbstractProcessingHandler::write(array $record): void in [...]\vendor\wazaari\monolog-mysql\src\MySQLHandler\MySQLHandler.php on line 164