You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why eloquent not open a transaction automatically when performing a write operations?
for example the push method, could perform many write operations when saving models and relationship, and no transaction are used.
the push method should perform all the write operations within a transaction or if a save will fail, the data remain corrupted.
another example is that is common that eloquent model events are used for save additional data when a model is created or updated.
the data created in an eloquent event, should be eliminated if the primary model save fails.
i use the cakephp framework too and in cakephp models, every single method that write data in the database, is automatically wrapped in a trasaction, and it is very helpful.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Why eloquent not open a transaction automatically when performing a write operations?
for example the push method, could perform many write operations when saving models and relationship, and no transaction are used.
the push method should perform all the write operations within a transaction or if a save will fail, the data remain corrupted.
another example is that is common that eloquent model events are used for save additional data when a model is created or updated.
the data created in an eloquent event, should be eliminated if the primary model save fails.
i use the cakephp framework too and in cakephp models, every single method that write data in the database, is automatically wrapped in a trasaction, and it is very helpful.
what do you think about it?
Beta Was this translation helpful? Give feedback.
All reactions