mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3443: Doctrine Custom Type always converted as string, when not wanted #4245
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 (Dec 9, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user Alsatian:
Hello,
trying to define a Custom Type in my Symfony2 application, I can't find how to write the convertToDatabaseValue function for working with native points in PostgreSQL (!= PostGIS extension).
Wished syntax :
'SELECT [...] FROM Addresses t0 WHERE t0.location = ?' with params ['(2.352,48.857)']I use this convertToDatabaseValue function :
DQL, creates this SQL query :
'SELECT [...] FROM Addresses t0 WHERE t0.location = ?' with params ["'(2.352,48.857)'"]-> Double quotes are automatically added, the parameter is interpreted as string.
I don't know if it is a bug or if I am doing anything wrong ?
Thank you.
@doctrinebot commented on GitHub (Dec 10, 2014):
Comment created by @ocramius:
Please check http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html and compare it with your codebase.
@doctrinebot commented on GitHub (Dec 10, 2014):
Comment created by Alsatian:
As I understand, the function convertToDatabaseValue build the format from the value into "with params (############)"
But it does always put double quotes so that my value becomes a string.
convertToDatabaseValueSQL build the format before, at the placeholder and here, I don't want to change anything.
I tried also
getBindingType(){
return \PDO::PARAM_NULL;
}
Hoping that were going to remove the quotes, but it doesn't.
Any suggestion ?
@doctrinebot commented on GitHub (Dec 12, 2014):
Comment created by @deeky666:
Not sure but I think the double quotes are just added for the debug output. What would be the native SQL that you expect?
I think you will have to define \PDO::PARAM_STRING as binding type and remove the single quotes around your database value:
@doctrinebot commented on GitHub (Dec 19, 2014):
Comment created by Alsatian:
OK it is working without parenthesis ...
Thank you for your help .
@doctrinebot commented on GitHub (Dec 19, 2014):
Comment created by Alsatian:
There were no problem, wrong syntax in my custom Typ ...
@doctrinebot commented on GitHub (Dec 19, 2014):
Issue was closed with resolution "Won't Fix"