# |
Jun 29th 2017, 06:09 |
savant |
but dont handle transactions like that in `Model.afterSave` |
# |
Jun 29th 2017, 06:09 |
savant |
looks like we handle that case for `Model.beforeSave` |
# |
Jun 29th 2017, 06:09 |
savant |
https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L1789-L1793 |
# |
Jun 29th 2017, 06:06 |
Sebollson |
you want to say that afterSave ->false in table will not rollback either? |
# |
Jun 29th 2017, 06:06 |
Sebollson |
wait |
# |
Jun 29th 2017, 06:05 |
Sebollson |
returning false in afterSave in behavior does not rollback the transaction |
# |
Jun 29th 2017, 06:05 |
savant |
what makes you say that |
# |
Jun 29th 2017, 06:05 |
savant |
why isnt it |
# |
Jun 29th 2017, 06:05 |
Sebollson |
not* |
# |
Jun 29th 2017, 06:05 |
Sebollson |
but it now ;( |
# |
Jun 29th 2017, 06:05 |
savant |
it should be the same |
# |
Jun 29th 2017, 06:04 |
Sebollson |
i think that behavior events should be threated the same |
# |
Jun 29th 2017, 06:04 |
Sebollson |
and it would work |
# |
Jun 29th 2017, 06:04 |
Sebollson |
normally I would reutrn false in afterSave method of table |
# |
Jun 29th 2017, 06:04 |
savant |
if you want to screw with its connection |
# |
Jun 29th 2017, 06:03 |
savant |
but you may need to get a reference to the table |
# |
Jun 29th 2017, 06:03 |
Sebollson |
normally |
# |
Jun 29th 2017, 06:03 |
Sebollson |
as special case of ORM event listener |
# |
Jun 29th 2017, 06:03 |
savant |
it should |
# |
Jun 29th 2017, 06:03 |
Sebollson |
shouldnt it work the same ? |
# |
Jun 29th 2017, 06:03 |
Sebollson |
but in case of behaviors |
# |
Jun 29th 2017, 06:03 |
Sebollson |
i know that beforeSave in table is not the same as beforeSave event |
# |
Jun 29th 2017, 06:03 |
Sebollson |
but now |
# |
Jun 29th 2017, 06:03 |
savant |
sad panda |
# |
Jun 29th 2017, 06:03 |
savant |
:( |
# |
Jun 29th 2017, 06:02 |
Sebollson |
in both cases I have to rollback |
# |
Jun 29th 2017, 06:02 |
Sebollson |
and target entity |
# |
Jun 29th 2017, 06:02 |
Sebollson |
during saving of audit entity |
# |
Jun 29th 2017, 06:02 |
Sebollson |
and I have 2 possible points of failure |
# |
Jun 29th 2017, 06:02 |
Sebollson |
its about audits |
# |
Jun 29th 2017, 06:02 |
Sebollson |
i have to |
# |
Jun 29th 2017, 06:02 |
savant |
but that should work |
# |
Jun 29th 2017, 06:02 |
Sebollson |
:) |
# |
Jun 29th 2017, 06:02 |
savant |
YOLODB |
# |
Jun 29th 2017, 06:02 |
savant |
i dont use transactions usually |
# |
Jun 29th 2017, 06:01 |
savant |
so if the dispatchEvent rolls it back, then you’re fine |
# |
Jun 29th 2017, 06:01 |
savant |
checks to see if we’re in a transaction |
# |
Jun 29th 2017, 06:01 |
savant |
because this line: https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L1852 |
# |
Jun 29th 2017, 06:00 |
Sebollson |
lets try it out |
# |
Jun 29th 2017, 06:00 |
Sebollson |
#ic |
# |
Jun 29th 2017, 06:00 |
savant |
$this->getConnection()->rollback() |