[DDC-648] Custom mapping types for multiple DB columns Created: 20/Jun/10  Updated: 22/Mar/12  Resolved: 20/Jun/10

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: New Feature Priority: Major
Reporter: Jan Tichý Assignee: Roman S. Borschel
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates DDC-93 It would be nice if we could have sup... Resolved

 Description   

Hello,

In current custom mapping types implementation there is a limit that it maps one entity property to just one database column.

It would be great to be able to map one entity property do multiple database columns. It would make custom mapping types much more useful and elegant!

FOR EXAMPLE in my application I have a simple class for geo coordinates:

class Point
(
...
public function getLatitude() ...
public function getLongitude() ...
public function setLatitude($latitude) ...
public function setLongitude($latitude) ...
....
)

And I have an entity that besides all other properties has a point:

/** @entity */
class Poi
{
/**

  • @column(type='foobar')
  • @var Point
    */
    private $point;

public function getPoint()

{ return $this->point; }

public function setPoint(Point $point)

{ $this->point = $point; }

}

And database structure is something like this:

CREATE TABLE poi (
...
latitude FLOAT,
longitude FLOAT,
...
);

Advanced custom mapping types should be able to map my Point instance from entity property $point to both latitude and longitude columns in database and vice versa.

Yes, I can do it in some complicated way with @prePersist, @preUpdate... events, but use of custom mapping types is much more natural, elegant, transparent and reusable...

Is there a chance for rapid change of how custom mapping types act?

Thanks, Jan



 Comments   
Comment by Benjamin Eberlei [ 20/Jun/10 ]

Duplicate of DDC-93

Comment by Benjamin Eberlei [ 22/Mar/12 ]

A related Github Pull-Request [GH-265] was
https://github.com/doctrine/doctrine2/pull/265

Generated at Sun Nov 23 07:23:13 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.