mercredi 23 novembre 2016

What happens to a Laravel DB Transaction if an exception is thrown?

I think* the transaction is just discarded. Is this accurate?

I'm using mysql

Example:

try {
    DB::beginTransaction();
    throw new Exception("something happened");
    DB::commit()
} catch (Exception $e) {
    Log::debug("something bad happened");
}

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire