mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3319: Get the converted value in convertToDatabaseValueSQL() #4102
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Sep 23, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user benjamin:
I have a use case where it would be useful to get the value being converted in the convertToDatabaseValueSQL() method, not just in convertToDatabaseValue().
Take the following mapping for a Geometry type:
In GIS-enabled databases, ST_GeomFromWkb() takes two parameters: the WKB binary representation of the geometry, and an integer representing the SRID (coordinate system) of the geometry, in this example the hardcoded value 4326.
I would be nice to have access to the value being converted in the convertToDatabaseValueSQL() as well, to be able to get the SRID from the geometry object itself, and replace the above code with something like:
I don't think there is currently a technical way to do this (please correct me if I'm wrong).
Could we find a BC way to pass the value being converted to the convertToDatabaseValueSQL() method to add support for this use case?
@doctrinebot commented on GitHub (Jan 25, 2015):
Comment created by nasumilu:
The use case which you described above would be a great addition to the convertToDatabaseValueSQL()* or in the convertToDatabaseValue() be able to return an array of values which could be used in the *convertToDatabaseValueSQL().
@doctrinebot commented on GitHub (Jan 25, 2015):
Comment created by benjamin:
[~nasumilu] It's an interesting idea, it would work as well, although I think it might be much more complicated to implement!
@doctrinebot commented on GitHub (Feb 1, 2015):
Comment created by agopaul:
It there a workaround for this? I'm probably going to use a native query.
My use case is pretty common among Postgres full-text users: I need to insert a record
using the ts_vector() function with both parameters, eg: ts_vector('english', 'This is a test'),
and both parameters has to be passed on record creation.