We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    So I’m looking at xPDO, and a problem that I encountered in RoR seems to be appearing here...

    What if I want to create a relational mapping between two tables in different databases? Ex:

    DB: users
    table: users
    columns: id, name

    DB: hr
    table: appointments
    columns: id, user_id

    And I want to link the appointments table’s FK to the users table’s PK...how would I go about that in xPDO? Is it even possible?
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
    • Quote from: splittingred at Feb 08, 2007, 02:57 PM

      So I’m looking at xPDO, and a problem that I encountered in RoR seems to be appearing here...

      What if I want to create a relational mapping between two tables in different databases? Ex:

      DB: users
      table: users
      columns: id, name

      DB: hr
      table: appointments
      columns: id, user_id

      And I want to link the appointments table’s FK to the users table’s PK...how would I go about that in xPDO? Is it even possible?
      Not really. In this case, you’re going to need to create two instances of xPDO, and you’ll need to write the functions to handle the inter-db relationship. So I suppose the answer is, you can’t do this with a single instance of xPDO, yet, but it’s not at all difficult to work with objects between two instances. You just won’t have the benefits of the aggregate and composite definitions.

      If you have any ideas on how to better approach this so you could use a single xPDO instance for that, I’m certainly willing to solve the issue...