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


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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