Support the ongoing development of Laravel.io →
Database Eloquent Architecture
Last updated 1 year ago.
0

Looking at the transaction code in Illuminate\Database\Connection.php it makes sense that having both records inserted into the Device table is happening.

I would wager that this is the intended behaviour and not a feature/bug. Dealing with transactions across multiple separate pieces of code is almost as terrible as dealing with time zones or character encoding. It looks like the transactions property of the Connection instance is an unfortunate necessity to work around people beginning multiple transactions.

As transactions are meant to allow a single 'atomic' write to multiple database tables in order to support atomic actions in your business logic, it doesn't make sense to me that you would rollback a portion of the transaction. It really should be an all or nothing thing.

Perhaps it should be documented somewhere that nested transactions are not supported by Eloquent.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

prady00 prady00 Joined 13 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.