We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42604
    • 6 Posts
    Hello,
    Sorry for the huge post but I have no idea how to figure out the below.
    I've got an issue with custom xpdo objects. there's XML schema with three objects type in my custom component: hosts, services, logs. Host is the main objects. I want to do the following:

    • When host is deleted services and logs have to be deleted too.
    • When service is deleted logs have to be deleted too.


    But when I am deleting host the error message puts in error log: Error removing dependent object. At the end host is deleted successfully but all dependent objects remain in db.
    I've read somewhere that commenting line 1642 in /core/xpdo/om/xpdoobject.class.php resolves that issue. And it really does. After commenting all depending objects removing successfully on event of host deletion.
    But one issue still exists. I can't make logs to be deleted on service deletion process. Service deleted but all logs entries stay in db. I've attached my schema files. The cause of the problem might be within it.

    This question has been answered by kookabura. See the first response.

    [ed. note: kookabura last edited this post 9 years, 2 months ago.]
    • discuss.answer
      • 42604
      • 6 Posts
      Found difference. For service deletion I used removeCollection() instead of remove().
      As I changed function to remove service deletion started working as expected.
      That's strange behavoir of removeCollection function. Hope that'll save time for somebody in future.