On 10/6/06, AD7six <[EMAIL PROTECTED]> wrote: > Going from a Person/Organisation to an address should be fairly easy: > Person/Org > var $hasMany = array( > 'Comment'=>array( > "foreignKey"=>"foreign_id", > > "conditions"=>"`Comment`.`class`='person'", > "dependent"=>true, > ) > );
How nice! I overlooked that I can specify $conditions on an association. However, strictly speaking it does not provide any way to prevent an Address to belong to a Person and an Organization at the same time. Maybe I should implement a "type" attribute after all... but I didn't want to do that, since I considered it a derived column (person_id filled --> type = "person", organization_id filled --> type = "organization"). Martin -- Martin Schapendonk, [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---