On 10/11/06, AD7six <[EMAIL PROTECTED]> wrote:
> >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.
>
> ?
>
> If on the address table there are 2 fields 'class' and 'foreign_id'
> which are used to define to which class and object the address relates
> it is not possible for the same address to point to more than one
> person/org. If you are defining in the person/org class which is their
> address by setting a field named address_id the foreign key is in the
> wrong table.

In that case, you're right.

I was thinking about an addresses table with two columns "person_id"
and "organization_id". This does not prevent an address from belonging
to an organization and a person at the same time.

I think the "foreign_id" column pointing to either persons or
organizations is not such a nice solution, since it removes the
possibility of having a foreign key relation in the database.

In the database (in my case, usually Oracle) I would implement things
with an optional foreign key relation and a check constraint that
specifies that only one of the two columns may be filled. I was
looking for some similar functionality in CakePHP.

Regards,

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to