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?
-
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.