Have slight issue related to a custom db i have created, i have a one to many relationship set up using migxdb and everything is working fine.
So i have my CMP, i have both tables hooked up together in a relationship so that if i call the object->remove() in a snippet for that package it removes the primary entry and all of its related items in the related table.
the issue i have is that i want to replicate this functionality in the MIGXdb CMP so then if i mark something for deletion and then “empty trash” it will then remove those entries and the related objects in its related table. Is there some “hook” or block of code i can put somewhere in the migx config setup to trigger on empty trash to trigger the related items to be removed also as per the schema.
seems, it wasn’t a good idea to use xpdo-exec here
and needs to be fixed
you could use a custom default/emptytrash - processor in your own package for now, where you iterate over a collection, filterd by deleted items and use object->remove in the loop
Thanks for the super prompt reply, how would i go about doing that, i have created a package already for my project. Are you saying that i should replicate the structure used in the migx package such as mypackage/processor/mgr/default/emptytrash.php in my own package?
How would i then get my custom emptytrash to be read by my migx CMP when someone presses the empty trash button? Does this happen automatically because i have the right structure?
Also, would i use something in my own custom emptytrash similar to how you are clearing the cache in the default?
Just got round to looking at this again, and I’m not sure if i want to go the route of creating another emptytrash for my package.
Reason being is that i have multiple related tables in this package and when i empty the trash of some of them i don’t want it to delete the related objects for those particular tables (even though they are related in my schema).
Is there an alternative way of triggering the same functionality but only for the migxdb config i want it to work on.
I saw that in my migx config is a section for extra handlers and specifically emptyTrash
Also i saw the section within my migxdb settings for hook snippets.
That has the same functionality you mentioned above but this way it only triggers my extra code for this classkey as apposed to the alternative that would trigger across my entire package of related tables whenever i emptied that trash for one of those tables?