Results 1 to 3 of 3

Thread: Callback system for enabling deleting child records

  1. #1
    New user
    Join Date
    10-01-14.
    Posts
    2

    Default Callback system for enabling deleting child records

    I've a question about deleting records in a table.
    My Contao extension consists out of various "child tables" and I was wondering if there is a way of programming to avoid problems with not available "linked" child records in a parrent table.

    I had already a look into the ondelete_submit functionality, but this didn't work for me (yet).
    The way I see it is that there are 2 options:
    - As soon as the command delete is given a check is started to see if the actual (child) record has a relationship with a parent table. If not -> execute delete command, else cancel operation.
    - As the DCA form is loaded, for each row is checked on an existing relationship. If available, the the operation option "delete" is blanked out.

    So, I was wondering if someone here has some expierence with this issue. If you could then provide me some sample code would be great.
    Thanks in advance!

  2. #2

    Default

    Hello !

    Maybe you can just use Foreign Key in the SQL and just "On delete cascade" sql property ?
    (Don't know if it works but it seems to be the good way to do it )

    Look at the relation between tl_page and tl_article, they have the same structure that what you try to do with specifics DCA :-)

  3. #3
    New user
    Join Date
    10-01-14.
    Posts
    2

    Default

    Hi Lupos,

    Thx for your reply.
    I saw that there are DCA settings where you can specify the behaviour of the linked child record(s) when you delete the parrent record. I didn't find a setting that works the other way arround.

    I will have a look in the construction tl_page and tl_article. Thanks for the suggestion.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •