1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Merge commit 'origin/master'

This commit is contained in:
Roman S. Borschel 2010-05-05 10:58:49 +02:00
commit 51f9fb35c6

View File

@ -224,6 +224,33 @@ The following example sets up such a unidirectional one-to-many association:
> **NOTE**
> One-To-Many uni-directional relations with join-table only work using the @ManyToMany annotation and a unique-constraint.
++ Many-To-One, Unidirectional
You can easily implement a many-to-one unidirectional association with the following:
[php]
/** @Entity */
class User
{
// ...
/**
* @ManyToOne(targetEntity="Address")
* @JoinColumn(name="address_id", referencedColumnName="id")
*/
private $address
}
/** @Entity */
class Address
{
// ...
}
> **TIP**
> The above `@JoinColumn` is optional as it would default to `address_id` and `id`
> anyways. You can omit it and let it use the defaults.
++ One-To-Many, Bidirectional
Bidirectional one-to-many associations are very common. The following code shows an example with a Product and a Feature class: