I have an attributed many-to-many association that - given a particular value of the attribute - collapses into a one-to-one association. My question is how do I get a joined list of those 1:1 entities in an efficient way?
I will make it more precise. I have two entities "person" and "room". Each person can rent arbitrary many rooms and each room can be rented by arbitrary many persons but for every point in time each person can only rent at most one room and one room can be rented at most by one person. To model this association I use a third entity "allocation" that has the attribute "period". Technically the many-to-many association is broken into two one-to-many associations. At the SQL level as well as at the business logic model it is ensures that it is impossible to insert allocations with overlapping time intervals (aka periods) for the same person and/or apartment. What I want to do is to obtain a list of all rooms together with the person that rented this room at a fixed point of time. On the SQL level it is quite easy SELECT r.*, p.* FROM room r JOIN allocation a ON ( r.id = a.room_id ) JOIN person p ON ( a.person_id = p.id ) WHERE now()::date <@ a.period; The SQL statement returns all columns of room (r) and all columns of person (p) correctly associated 1:1 with each other. How can I get this into Doctrine? -- 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.
