On Tuesday, 1 April 2014 10:48:22 UTC+2, Jàπ (Jasper N. Brouwer) wrote: > > The reason I suggest using 2 `Relation` entities is because using this > throughout your app will be much easier. When you need to know all the > relatives of User(1), you can simple query all `Relation::$relatedToUser` > users where `Relation::$user` is User(1). > When using only one `Relation` entity, you would have to query for all > `Relation::$relatedToUser` users where `Relation::$user` is User(1) OR all > `Relation::$user` users where `Relation::$relatedToUser` is User(1). >
Many ways leading to Rome... Thank you for your advice, Jasper. Very interesting. But I personally would use 1 Relation entity instead of 2 here, as it is modeling one and the same relation, only named differently from the other perspective. Your choice to model that as two different "things" is a valid one, of course, but I prefer to stay as much as possible to the domain I'm modeling. Probably this is just a matter of a bit different implementation of the same model, but you cannot see child-of and parent-of separately of each other: it is just the same "thing", with two different names. -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
