Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.2
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
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.
For example:
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 ?
// Modify the column SQL for insert public function getSqlInsertColumn(....)
// Modify the column SQL for update public function getSqlUpdateColumn(....)
// Modify the column SQL for select public function getSqlSelectColumn(....)
// A possible example of getSqlSelectColumn(...) public function getSqlSelectColumn($doctrineSql) { // $doctrineSql == "p0_.the_geom" return 'ST_AsText(' . $doctrineSql . ')'; }
Issue Links
- is duplicated by
-
DBAL-53
Missing convertToDatabase-calls when loading and persisting entities
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Description |
I have create a custom type called point but need a way to have a function called on columns of this type when fetching / updating / inserting entities. For example: 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 ? {code} // Modify the column SQL for insert public function getSqlInsertColumn(....) {code} {code} // Modify the column SQL for update public function getSqlUpdateColumn(....) {code} {code} // Modify the column SQL for select public function getSqlSelectColumn(....) {code} {code} // A possible example of getSqlSelectColumn(...) public function getSqlSelectColumn($doctrineSql) { // $doctrineSql == "p0_.the_geom" return 'ST_AsText(' . $doctrineSql . ')'; } {code} |
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. For example: 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 ? {code} // Modify the column SQL for insert public function getSqlInsertColumn(....) {code} {code} // Modify the column SQL for update public function getSqlUpdateColumn(....) {code} {code} // Modify the column SQL for select public function getSqlSelectColumn(....) {code} {code} // A possible example of getSqlSelectColumn(...) public function getSqlSelectColumn($doctrineSql) { // $doctrineSql == "p0_.the_geom" return 'ST_AsText(' . $doctrineSql . ')'; } {code} |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Invalid [ 6 ] |
| Resolution | Invalid [ 6 ] | |
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
| Fix Version/s | 2.1.0 [ 10068 ] |
| Attachment | 022-doctrine-basic-entity-persister.diff [ 10980 ] | |
| Attachment | 024-doctrine-many-to-many-persister.diff [ 10981 ] | |
| Attachment | 025-doctrine-unit-of-work.diff [ 10982 ] |
| Attachment | 029-doctrine-query.diff [ 10983 ] |
| Fix Version/s | 2.2 [ 10142 ] | |
| Fix Version/s | 2.1 [ 10068 ] |
| Attachment | doctrine-type.diff [ 11072 ] |
| Project | Doctrine DBAL [ 10040 ] | Doctrine 2 - ORM [ 10032 ] |
| Key | DBAL-15 |
|
| Security | All [ 10000 ] | |
| Fix Version/s | 2.2-DEV [ 10157 ] | |
| Fix Version/s | 2.2 [ 10142 ] |
| Status | Reopened [ 4 ] | Closed [ 6 ] |
| Resolution | Fixed [ 1 ] |
| Workflow | jira [ 11436 ] | jira-feedback [ 15640 ] |
| Workflow | jira-feedback [ 15640 ] | jira-feedback2 [ 17504 ] |
| Workflow | jira-feedback2 [ 17504 ] | jira-feedback3 [ 19761 ] |