Open kumy opened 5 years ago
(Moved from https://github.com/ikkez/f3-cortex/issues/90)
When we rollback a transaction, the previously saved objects stay in a valid state (valid per use of dry()/valid() functions).
dry()
valid()
I would have expected the dry() function to return true.
true
here is a little example:
$f3->get('DB')->begin(); $move = new Move(); $move->comment = 'Some comment'; var_dump(move->dry()); $move->save(); var_dump(move->dry()); $f3->get('DB')->rollback(); var_dump(move->dry());
This outputs:
bool(true) bool(false) bool(false)
But I expect it to return:
bool(true) bool(false) bool(true)
That's not possible since the DB class is not aware of all the mappers relying on it.
Just call reset() when the rollback is successful:
reset()
$f3->get('DB')->rollback() && $move->reset();
(Moved from https://github.com/ikkez/f3-cortex/issues/90)
When we rollback a transaction, the previously saved objects stay in a valid state (valid per use of
dry()
/valid()
functions).I would have expected the
dry()
function to returntrue
.here is a little example:
This outputs:
But I expect it to return: