We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34012
    • 88 Posts
    Have to accompany here, use Bob's snippet if you are even slightly unsure what is going around to reverse engineer the database tables.

    For those who would like to have aggregate/composite relationships automatically. That is under the gun from my side but it ain't that easy. It is doable, but lot more complex than any query build with xPDO to this date. And reason why:

    xPDO now supports 3 database platforms officially, add 2 that I've build so we have 5 platforms. If all of these engines would follow ANSI SQL standard this would be piece of cake but each of them has own methods and just even inside the platform itself. Good example is MySQL ISAM vs InnoDB. Where InnoDB actually has foreign key relations and ISAM does not. So to "us" predict the behaviour of foreign key relations with ISAM is impossible.

    I was already building this for the Oracle driver when I spend time with it, but it was not as this straight forward even the database does support FK relations. The issues is that when we build xPDO schema, we have Parent to Child relation where parent with composite relation says that "Destroy the children when I am removed" and in SQL world this is reversed. Everything is written to children even the behaviour is the same.

    To reverse engineer this behaviour solidly takes time, it is doable but now when there are 5 platforms to support (unofficially) it is really a work to be done. Each of the platforms has their own quirks.

    This should have been it's own post to be honest, but wrote here for some reason. I do encourage to use Bob's snippet or read how to write it as an snippet from my site. Just remember that I use $xpdo syntax where MODX users need to use $modx smiley
      Almost retired from web-development industry but still randomly writing at Lazylegs.info and on schedule hopefully in near future to finish Oracle and PostgreSQL ports of MODX