We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21120
    • 30 Posts
    Is it possible to define relationships between the core tables and an external database?

    As of now, i’ve been dealing with external databases by creating a new xPDO instance and passing it modx objects, but i’d like to be able to skip that step and automatically use aggregate and composite relationships.

    Can that be done? and, if not, is anything like that planned for future versions?
      • 34193
      • 330 Posts
      There are currently ways of extending the user tables. http://rtfm.modx.com/display/revolution20/Extending+modUser

      Which creates links between the user table and an external one.
        • 21257 MODX Staff
        • 730 Posts
        One xPDO instance can’t manage data in two databases.
        You could override some of xPDO’s methods in the classes where you want these relationships, achieving the ability to work with records in an external database as you would with "normal" aggregates and composite relationships. It would take some thinking, clarifying your oo design etc (eg providing one xPDO instance with a reference to another etc). It would be a custom solution, perfectly valid, but I think it’s why there’s no generic way of handling this.
          Mike Schell
          Lead Developer, MODX Cloud
          Email: [email protected]
          GitHub: https://github.com/netProphET/
          Twitter: @mkschell