Hello everybody!
Does anybody know is there a way to define Many to Many relationship between objects without using additional table?
-
MODX Staff
- 730 Posts
The only place to put the relationship data would be in the existing tables.
For example, a field containing a list of ids of related objects.
If you were going to do this in xPDO, you’d need to override some xPDOObject methods like getOne, getMany, addOne, addMany, save, remove and others in order to preserve the relationship data.
By far the easiest and most efficient way would be to create the extra table containing the intersect objects. That table would just hold the pairs of ID numbers of the related objects.