0

in my custom module, I have two tables with 1 to many relationships. Now in my admin UI Grid whenever I delete the record it does not delete it.

My question is how i can delete record from both tables at once. Any help would be appreciated.

enter image description here

1 Answer 1

0

set ON DELETE CASCADE when you set FOREIGN KEY in your second table.

4
  • in installSchema.php?
    – sudo55
    Nov 6, 2019 at 7:34
  • Yes in installSchema Nov 6, 2019 at 9:01
  • it is already there. can u please paste code of Delete.php prnt.sc/pt51ch
    – sudo55
    Nov 6, 2019 at 9:34
  • No need to add an extra code of delete it will automatically delete record from the child table. Nov 6, 2019 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.