We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43966
    • 8 Posts
    Hi,

    when I use MIGXdb and I want to remove a multiple elements with migxdb's 'bulk-remove' on a custom manager page, I have to press the 'empty-trash'-button to remove my elements from the db. But I discovered that it won't delete the many-to-many table-rows even although I've use a aggregate-relationship.

    I have a many-to-many relation like the one described here: https://rtfm.modx.com/xpdo/2.x/getting-started/creating-a-model-with-xpdo/defining-a-schema/defining-relationships

    In this example I would want to remove multiple owners from the 'Owner'-table and I would expect that the relation-table 'StoreOwners' would be removed, too. It works when I remove a single object by the context menu when I right-click it, but it won't work with the bulk-remove -> empty-trash way.

    Is it normal or did I forget a setting?
      • 4172
      • 5,888 Posts
      I'm using

      $xpdo->exec("delete from {$tablename} where deleted = 1");


      to remove the records in the default processor. This doesn't respect the relations.
      You have to create your own emptytrash - processor, which loops the records with

      $object->remove();

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!