Type: New Feature
Affects Version/s: None
Fix Version/s: 2.2
Security Level: All
I have created a custom type called point but need a way to have a function called on columns of this type when fetching / updating / inserting entities.
Consider I have an entity which has a column called the_geom
This is associated with my custom type point
A basic select statement for this entity is as follows:
SELECT id, name, the_geom FROM points where id = 1
The problem is the_geom is encoded and on the PHP side I want it in human readable form. I would like a way to specify custom functions on SELECT / INSERT / UPDATE for columns of this custom type.
When selecting my entity I would like to execute the function ST_AsText(the_geom)
SELECT id, ST_AsText(the_geom) FROM points where id = 1
The same goes for updates and inserts. I would like to surround the column SQL with other custom functions, to encode my human readable text back to the encoded value for the DB.
Possibly this could be integrated into Doctrine\DBAL\Types\Type ?