I've added listener for queries as in, https://docs.phalcon.io/en/latest/reference/events.html#usage-example

and I'm wondering, what will be the best way to add TransactionManager to Listener?

https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Model_Transaction_Manager.html

        /**
     * Log all queries
     *
     * @param Event $event
     * @param Pdo   $connection
     */
    public function beforeQuery(Event $event, Pdo $connection)
    {
        $this->profiler->startProfile(
            $connection->getSQLStatement(),
            $connection->getSQLVariables()
        );
    }

    /**
     * Stop Profiler
     *
     * @param Event $event
     * @param Pdo   $connection
     */
    public function afterQuery(Event $event, Pdo $connection)
    {
        $this->profiler->stopProfile();
    }