# |
Sep 30th 2016, 14:38 |
birdy247 |
I set it up as per the docs |
# |
Sep 30th 2016, 14:38 |
birdy247 |
How do I run my own beforeDelete? |
# |
Sep 30th 2016, 14:37 |
birdy247 |
Neon1024 |
# |
Sep 30th 2016, 14:36 |
Neon1024 |
I donâ??t own it, itâ??s the communities code :D |
# |
Sep 30th 2016, 14:36 |
Neon1024 |
No, not â??myâ?? code, â??theâ?? code |
# |
Sep 30th 2016, 14:36 |
Neon1024 |
Not sure my code is clever enough to trash stuff it doesnâ??t know about :p |
# |
Sep 30th 2016, 14:35 |
Neon1024 |
https://github.com/UseMuffin/Trash/pull/12/files#diff-142591c35e3af31a6932558fbff20f26R325 |
# |
Sep 30th 2016, 14:35 |
birdy247 |
oh no |
# |
Sep 30th 2016, 14:35 |
birdy247 |
I need business logic in the beforeDelete |
# |
Sep 30th 2016, 14:35 |
Neon1024 |
So have you attached the Trash behaviour to Timetables? |
# |
Sep 30th 2016, 14:35 |
birdy247 |
but I am only using the beforeFind event |
# |
Sep 30th 2016, 14:34 |
birdy247 |
yes |
# |
Sep 30th 2016, 14:34 |
Neon1024 |
So youâ??ve attached the behaviour to Placements |
# |
Sep 30th 2016, 14:34 |
birdy247 |
:) |
# |
Sep 30th 2016, 14:34 |
birdy247 |
yes |
# |
Sep 30th 2016, 14:34 |
Neon1024 |
Ok, with you :) |
# |
Sep 30th 2016, 14:34 |
Neon1024 |
Placements hasMany Timetables, and Timetables belongsTo Placements |
# |
Sep 30th 2016, 14:33 |
birdy247 |
timetables has a placement_id |
# |
Sep 30th 2016, 14:33 |
Neon1024 |
So that means timetables.placement_id right? |
# |
Sep 30th 2016, 14:33 |
birdy247 |
when a placement is deleted, I want to soft delete the placement, and run beforeDelete on each timetable |
# |
Sep 30th 2016, 14:32 |
birdy247 |
So a placement hasMany timetables |
# |
Sep 30th 2016, 14:32 |
birdy247 |
ok |
# |
Sep 30th 2016, 14:32 |
Neon1024 |
Whatâ??s the use-case anyway? |
# |
Sep 30th 2016, 14:32 |
Neon1024 |
ADmad would be most dissapointed! ;) |
# |
Sep 30th 2016, 14:31 |
Neon1024 |
Eish! |
# |
Sep 30th 2016, 14:31 |
birdy247 |
I just copy/pasted the beforeDelete from the plugin to start with |
# |
Sep 30th 2016, 14:31 |
Neon1024 |
I did update the docs! :D |
# |
Sep 30th 2016, 14:30 |
Neon1024 |
Have you got the event priorities setup right? |
# |
Sep 30th 2016, 14:30 |
Neon1024 |
What does your beforeDelete do thatâ??s special? |
# |
Sep 30th 2016, 14:29 |
birdy247 |
It seems, using this, it does not honour the cascade callbacks |
# |
Sep 30th 2016, 14:29 |
birdy247 |
I decided to handle the beforeDelete myself |
# |
Sep 30th 2016, 14:29 |
birdy247 |
I am using muffin/Trash |
# |
Sep 30th 2016, 14:28 |
Neon1024 |
o |
# |
Sep 30th 2016, 14:28 |
birdy247 |
Neon1024 |
# |
Sep 30th 2016, 14:27 |
Neon1024 |
I did it in this plugin, https://github.com/UseMuffin/Trash/pull/12 |
# |
Sep 30th 2016, 14:27 |
admad |
@birdy247 yes it should |
# |
Sep 30th 2016, 14:27 |
Neon1024 |
Otherwise all the callbacks are skipped |
# |
Sep 30th 2016, 14:27 |
Neon1024 |
All it does is enable callback methods for bulk transactional updates |
# |
Sep 30th 2016, 14:27 |
Neon1024 |
Yeah, on the primary model |
# |
Sep 30th 2016, 14:26 |
birdy247 |
I thought that was what cascadeCallbacks was for? |
# |
Sep 30th 2016, 14:26 |
Neon1024 |
Iâ??d check the core unit tests for that |