|
(Thanks for the note about my article -- I cleaned up the wording a
little to cause less confusion) I thought along the exact same lines, thinking that belongsTo would better be referred to as hasOne, until I realized that I was getting stuck on how I assumed the semantics worked, according to how I would express the relationships in words. For me, the understanding all hinged on the concepts of ownership, and which action is "active": having or belonging (by active I mean doing the pointing -- referencing the other table with a field). You seem to be looking at relationships from the perspective of knowledge -- which object knows about the other. If this were the case, then your argument about the Thing not knowing anything about the Person would stand -- but CakePHP and most relational systems don't look at associations from that perspective, but rather from an ownership perspective. Remember this concept: Ownership is a property of the possession. That is to say, that the secondary or associated data is responsible for referencing the primary data, not the other way around. The possession belongs to the possessor. The possession is the item "doing" something -- the belonging. So then, the possessor is passive in the relationship. Ownership is passive, whereas membership is active. This is why it is the duty of the table with the possession to reference the table of the possessor. Having is best thought of as a passive state -- the table that "has" does not reference the tables who relate to it. If you're describing the relationship of a Person owning a Thing, since ownership is a property of the possession, the Thing will belongTo the Person (having a field in the Thing table which references a person). And conversely, the Person has(One|Many) Thing(s). Your implementation will always be dictated by the parameters within which you are operating. So if you're writing an app in an environment that describes the data differently than CakePHP's conventions -- you do what you have to do. But this does not mean that the semantics of the associations CakePHP applies are incorrect, but perhaps from a different perspective. -- Joshua Benner http://bennerweb.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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/cake-php?hl=en -~----------~----~----~----~------~----~------~--~--- |
- Re: Stuck - Join limitation in 1.2? Nick
- Re: Stuck - Join limitation in 1.2? Joshua Benner
