I created a sqlite3 impmentation:
<?php
$di = new \Phalcon\DI\FactoryDefault();
$di->set('db', function() {
$eventsManager = new Phalcon\Events\Manager();
$eventsManager->attach('db', function($event, $connection) {
echo 'Event fired: ' . $event->getType() . PHP_EOL;
});
$connection = new \Phalcon\Db\Adapter\Pdo\Sqlite([
'dbname' => __DIR__ . '/db.sqlite'
]);
$connection->setEventsManager($eventsManager);
return $connection;
});
$db = $di->get('db');
$db->begin();
$db->query("SELECT * FROM test");
$db->rollback();
$db->begin();
$db->query("SELECT * FROM test");
$db->commit();
$db->close();
And it dump following:
Event fired: beginTransaction
Event fired: beforeQuery
Event fired: afterQuery
Event fired: rollbackTransaction
Event fired: beginTransaction
Event fired: beforeQuery
Event fired: afterQuery
Event fired: commitTransaction
afterConnect
, beforeDisconnect
and beforeTransaction
are not even fired. Can you paste here a doc link?