We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24719
    • 194 Posts
    i’ve worked out generating an xml schema from a database table, and generating classes from it. i was just wondering how to set relationships in the xml schema - i’m guessing this would be much easier than hand-coding relationships in each classes metadata.

    i’m sure just a quick example of the relevant tags and attributes would suffice so that i can get cracking. i’m champing at the bit to put xpdo to work in my current project.

    thanks, i appreciate people are busy
    • How about an example.

      I’ve attached here a version of the XML schema for 0.9.7 so you can consider these relationships to the tables in MODx you may already be familiar with. There should be an example of just about any typical relationship in there, and some non-typical, but feel free to ask questions about specific kinds of relationships modeled in this schema, or your own.

      Note that every relationship should typically involve defining the relationships both ways, so you can access related instances regardless of which one you have an instance of. For example, in cases where you design a cross-reference table for a one-to-many, the cross reference will have cardinality="one" to the independent tables, while they have a cardinality="many" going back to the cross reference. In addition, the independent tables would define their relationship to the cross reference as a composite relationship, while the cross reference would define aggregate relations to the independents.

        • 24719
        • 194 Posts
        thanks a lot