PhalconException: There is no active transaction when executing more than 2 transactions..

I have encountered an annoying issue whereby if I commit more than two transactions one after another, the third will throw a PhalconException with the error message "There is no active transaction"

I have written a really simple gist to illustrate the issue. It can be seen here:

The first two transactions are committed successfully and the data is saved in the database. The third crashes with an uncaught exception.

I am using Phalcon 1.3.2 and mySQL.

Does anyone have any insight as to whether this is a bug, or is this a ridiculously obvious oversight (somewhere) on my part?

Thanks T

Edit: To clarify 'transactionManager' is a shared service.

edited Apr '15

So I have managed to get this working, but not in the manner that I would have liked.

There is still an issue here, and any additional clarification would be appreciated.

If I explicitly add $this->transactionManager->collectTransactions() to the end of each interaction in my contrived example above then things work.

In my real world example they do not. In my real world code the above example is housed in a service layer 'Service.php' which calls through to my DAO classes 'dao1.php' and 'dao2.php' which each implement 'InjectionAwareInterface' and access (what should be the same) transaction using $this->transactionManager->get()

It seems that with this separation things do not work - the exception described above is thrown.

I have gotten things working by 'getting' a transaction in the service layer and passing it to each respective DAO. This is actually a better architecture in the grand scheme but I am still intrigued as to the underlying cause of the issue.

Any insight appreciated.

Out of curiousity (May or may not be related), is your database service set as shared or not?