1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/manual/docs/Mapping object relations - Foreign key associations - One-to-One.php

8 lines
622 B
PHP
Raw Normal View History

2006-07-24 01:08:06 +04:00
Binding One-To-One foreign key associations is done with Doctrine_Record::ownsOne() and Doctrine_Record::hasOne() methods.
In the following example user owns one email and has one address. So the relationship between user and email is one-to-one composite.
The relationship between user and address is one-to-one aggregate.
<br \><br \>
The Email component here is mapped to User component's column email_id hence their relation is called LOCALKEY relation.
On the other hand the Address component is mapped to User by it's user_id column hence the relation between User and Address is called
FOREIGNKEY relation.