Details
Description
class User {
/**
* @Column(type="string")
*/
private $address;
/**
* @Column(type="string")
*/
private $city;
/**
* @Column(type="string")
*/
private $state;
}
We could have:
class User {
/**
* @Component(class="Address")
*/
private $address;
}
It would my life a lot easier....
Notes for implementation
Value objects can come in two forms:
a) as embedded value objects
b) as collections of value objects
An implementation should concentrate on a) first. The following things all concentrate on a).
DQL Support
Conditions:
1. "select f from Foo f where f.embedded.value = ?1" (setParameter(1, $scalarValue))
2. "select f from Foo f where f.embedded = ?1" (setParameter(1, $embeddedValueObject))
At least Nr.1 must be possible in a first implementation.
Selecting:
1. "select f from Foo f" must explode embedded value objects in the SQL SELECT clause.
2. "select f.embedded from Foo f" must explode the columns of the embedded object in the SQL SELECT clause.
At least Nr. 1 must be possible in a first implementation, obviously.
Components affected (among others): Parser, SqlWalker, ...
Persisters
The persisters need to take embedded value objects into account when persisting as well as loading entities.
Components affected (among others): Persisters, UnitOfWork, ...
Metadata
ClassMetadataInfo needs to be extended with a field (probably an array) that contains the mappings of embedded values.
New annotations as well as XML/YAML elements are needed.
Components affected (among others): ClassMetadataInfo, AnnotationDriver, YamlDriver, XmlDriver, doctrine-mapping.xsd, ...
Change Tracking
If value objects are supposed to be immutable this is easy and might require no or few changes. If, however, we want to track changes in mutable value objects it might get more complicated.
Components affected (among others): UnitOfWork, ...
Issue Links
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
class User { /** * @Column(type="string") */ private $address; /** * @Column(type="string") */ private $city; /** * @Column(type="string") */ private $state; } We could have: class User { /** * @Component(class="Address") */ private $address; } It would my life a lot easier.... |
class User { /** * @Column(type="string") */ private $address; /** * @Column(type="string") */ private $city; /** * @Column(type="string") */ private $state; } We could have: class User { /** * @Component(class="Address") */ private $address; } It would my life a lot easier.... |
| Fix Version/s | 2.1 [ 10022 ] |
| Description |
class User { /** * @Column(type="string") */ private $address; /** * @Column(type="string") */ private $city; /** * @Column(type="string") */ private $state; } We could have: class User { /** * @Component(class="Address") */ private $address; } It would my life a lot easier.... |
{code} class User { /** * @Column(type="string") */ private $address; /** * @Column(type="string") */ private $city; /** * @Column(type="string") */ private $state; } {code} We could have: {code} class User { /** * @Component(class="Address") */ private $address; } {code} It would my life a lot easier.... |
| Description |
{code} class User { /** * @Column(type="string") */ private $address; /** * @Column(type="string") */ private $city; /** * @Column(type="string") */ private $state; } {code} We could have: {code} class User { /** * @Component(class="Address") */ private $address; } {code} It would my life a lot easier.... |
{code} class User { /** * @Column(type="string") */ private $address; /** * @Column(type="string") */ private $city; /** * @Column(type="string") */ private $state; } {code} We could have: {code} class User { /** * @Component(class="Address") */ private $address; } {code} It would my life a lot easier.... ---- h2. Notes for implementation Value objects can come in two forms: a) as embedded value objects b) as collections of value objects An implementation should concentrate on a) first. The following things all concentrate on a). h3. DQL Support *Conditions:* 1. "select f from Foo f where f.embedded.value = ?1" (setParameter(1, $scalarValue)) 2. "select f from Foo f where f.embedded = ?1" (setParameter(1, $embeddedValueObject)) At least Nr.1 *must* be possible in a first implementation. *Selecting:* 1. "select f from Foo f" must explode embedded value objects in the SQL SELECT clause. 2. "select f.embedded from Foo f" must explode the columns of the embedded object in the SQL SELECT clause. At least Nr. 1 *must* be possible in a first implementation, obviously. Components affected (among others): Parser, SqlWalker, ... h3. Persisters The persisters need to take embedded value objects into account when persisting as well as loading entities. Components affected (among others): Persisters, UnitOfWork, ... h3. Metadata ClassMetadataInfo needs to be extended with a field (probably an array) that contains the mappings of embedded values. New annotations as well as XML/YAML elements are needed. Components affected (among others): ClassMetadataInfo, AnnotationDriver, YamlDriver, XmlDriver, doctrine-mapping.xsd, ... h3. Change Tracking If value objects are supposed to be immutable this is easy and might require no or few changes. If, however, we want to track changes in mutable value objects it might get more complicated. Components affected (among others): UnitOfWork, ... |
| Fix Version/s | 2.x [ 10090 ] | |
| Fix Version/s | 2.1 [ 10022 ] |
| Assignee | Roman S. Borschel [ romanb ] | Guilherme Blanco [ guilhermeblanco ] |
| Workflow | jira [ 10295 ] | jira-feedback [ 13835 ] |
| Workflow | jira-feedback [ 13835 ] | jira-feedback2 [ 15699 ] |
| Workflow | jira-feedback2 [ 15699 ] | jira-feedback3 [ 17956 ] |
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-93, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
formated snippets nicely