doctrine/doctrine2 — pull request #265 by guilhermeblanco (2012-01-20 16:20:47+00:00)
Title: [WIP] Mapping support for Embeddables (VOs).

This patch is going to address: http://www.doctrine-project.org/jira/browse/DDC-93

Embeddable classes are a good way for organizing your domain model. Specially larger systems, which contains similar domain objects with similar properties.
This patch proposes a cleaner way to structure these duplicating attributes (and logic) into an @Embeddable object. Abstract the common information into an @Embeddedable object and use it as @Embedded.

```php
/**
* @Embeddable
*/
class Location
{
/** @Column(type="decimal", scale=8, precision=12, nullable=true) */
public $latitude;

/** @Column(type="decimal", scale=8, precision=12, nullable=true) */
public $longitude;
}

/**
* @Entity
*/
class User
{
/** @Id @GeneratedValue @Column(type="integer") */
public $id;

// ...

/** @Embedded(class="Location") */
public $location;
}
```

Querying:

```php
$query = $entityManager->createQuery('SELECT u FROM User u WHERE u.location.latitude = ?1');
```