This seems like a pretty standard many-to-many scenario. As such, the use of a lookup table that has rows pointing to the 2 other tables would be pretty common:
id important_info_id other_important_info_id That is the most common way I've seen many-to-many relationships handled. On Sep 9, 8:45 am, Crafty_Shadow <[email protected]> wrote: > In a project I have recently started I need to show a connection > between objects. For the sake of example let's say I have a database > structure similar to: > > child_record: > id: ~ > name: { type: varchar(255), required: true } > > slibling_relation: > first_child: { type: integer, foreignTable: child_record, > foreignReference: id, required: true, primaryKey: true, onDelete: > cascade } > second_child: { type: integer, foreignTable: child_record, > foreignReference: id, required: true, primaryKey: true, onDelete: > cascade } > > One child can have more than one slibling, but the essential part is > that they are of equal standing. One is not the "parent" of the other, > so I believe I need the intermediate table, > What I need to do is create an easy way to manage these relations > through the admin generator (a custom Widget), and appropriate peer > methods for retrieval of all siblings of a given child. I am familiar > enough with symfony to be able to implement those, but I'm wondering > what would be the best way to do so. > > Is my approach to the database shema optimal? > Any and all comments or suggestions are welcome. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
