Finish API for "many" relationships

Registered by Anthony Bush on 2008-09-23

Finish the API for one-to-many and many-to-many relationships.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Essential
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
Accepted for 1.4
Implementation:
Unknown
Milestone target:
milestone icon 1.4

Related branches

Sprints

Whiteboard

* Allow some kind of explicit support for many-to-many rather than just one-to-many-to-one. For example, consider allowing the user to specify relationships explicitly rather than just having everything be auto-detected. This would be similar to Rails and other frameworks, e.g. "product has_many platform [through product2platform]" where the through part would be optional if there is only one table linking product and platform together.

See meeting minutes: http://coughphp.com/blog/2008/09/24/minutes-coughphp-developers-meeting/

We revive the behavior with these restrictions:

* We continue to generate the one-to-many methods straight to the join table. These will be the preferred way of getting extra join data should it be needed. In other words, we will not revive the old way of getting and setting join data.

* We auto-detect, possibly using a many-to-many detection strategy so you can override the table_one2table_two naming convention (if using foreign keys, naming convention may not be required).

* While auto-detecting, if there is a conflict (more than one path to join two tables), we stop generating for that table’s classes and throw a warning for that table with instructions on how to specify which path is the correct one.

* We provide config option that allows specifying of correct path to join tables (required to satisfy above warning message requirement).

* We provide config option to turn off auto-detection all together. In this scenario, the only many-to-many generation would come from the above config option where items are explicitly specified.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.