thephpleague / tactician-doctrine

Tactician plugins for the Doctrine ORM, primarily transactions
MIT License
57 stars 13 forks source link

Question: why transactional() is not used #23

Closed simPod closed 5 years ago

simPod commented 5 years ago

I have been looking at https://github.com/thephpleague/tactician-doctrine/blob/master/src/ORM/TransactionMiddleware.php and wondering, why the transaction is handled manually there. Personally I'd choose to use ->transactional() instead of ->beginTransaction(). Is there any particular reason or is it just a matter of personal preference? Thanks!

rosstuck commented 5 years ago

Hi @simPod, this was previously discussed here: https://github.com/thephpleague/tactician-doctrine/issues/6

tl;dr Transactional messes with return values. If you have any other questions, feel free to reopen this ticket. :)

simPod commented 5 years ago

I see. But since that problem is fixed that custom transaction handling code in TransactionMiddleware is no longer necessary, am I right?

(https://github.com/doctrine/orm/blob/1dbacec0e4e1e9264d552441d9888b49a115b806/lib/Doctrine/ORM/EntityManager.php#L238 vs https://github.com/doctrine/orm/blob/0c2ccec9151fd0b44a60f9cc149e2a107d380799/lib/Doctrine/ORM/EntityManager.php#L241)

rosstuck commented 5 years ago

Sure, then it's a question of version support.

Getting it shorter would be cool and will definitely do it when Doctrine 3.0 rolls around but sans a PR with changes and tests, not really too worried about it in the meantime.

simPod commented 5 years ago

Kk, thanks for answers!