# |
Jun 29th 2017, 06:13 |
Sebollson |
expecially that there is afterSaveCommit anyway |
# |
Jun 29th 2017, 06:13 |
Sebollson |
it would seem right to rollback transaction afterSave |
# |
Jun 29th 2017, 06:12 |
savant |
since both the model method and the behavior calls will be triggered by the same code |
# |
Jun 29th 2017, 06:12 |
savant |
I’d do it there |
# |
Jun 29th 2017, 06:12 |
savant |
sure |
# |
Jun 29th 2017, 06:12 |
Sebollson |
audits* |
# |
Jun 29th 2017, 06:12 |
Sebollson |
but as a remedy for now, i should save my adutis in beforeSave am I correct ? |
# |
Jun 29th 2017, 06:12 |
savant |
it also wont rollback |
# |
Jun 29th 2017, 06:12 |
savant |
well if you return false from a Model aftersave |
# |
Jun 29th 2017, 06:12 |
Sebollson |
:) |
# |
Jun 29th 2017, 06:12 |
Sebollson |
thats what i would like to be able to do |
# |
Jun 29th 2017, 06:12 |
savant |
if a behavior aftersave returns false |
# |
Jun 29th 2017, 06:11 |
Sebollson |
ill submit an issue, probably it will get rejected but who cares, not the first rejected issue from me ;P:P |
# |
Jun 29th 2017, 06:11 |
savant |
seems like we can def at least rollback transactions |
# |
Jun 29th 2017, 06:11 |
savant |
yeah I would file an issue |
# |
Jun 29th 2017, 06:11 |
Sebollson |
but afterSave does not work like I am expecting they would |
# |
Jun 29th 2017, 06:11 |
savant |
yes they should |
# |
Jun 29th 2017, 06:11 |
Sebollson |
so in general as I understand correctly indeed events in behavior works the same as hooks in table |
# |
Jun 29th 2017, 06:10 |
Sebollson |
yes i think that I will |
# |
Jun 29th 2017, 06:10 |
savant |
Maybe you can request that we handle it for transactions? |
# |
Jun 29th 2017, 06:09 |
savant |
https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L1850 |
# |
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 ? |