Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add new 2.2 Types's functions relative to SQL conversion

  • Loading branch information...
commit 3b87e5f81f2554a777355cc62105ac185817275d 1 parent ed68431
@julienfastre julienfastre authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 en/reference/types.rst
View
26 en/reference/types.rst
@@ -132,6 +132,32 @@ Now we implement our ``Doctrine\DBAL\Types\Type`` instance:
}
}
+You can modify the SQL declaration Doctrine will use. First, you need to enable this feature by overriding the canRequireSQLConversion method:
+
+::
+
+ <?php
+ public function canRequireSQLConversion()
+ {
+ return true;
+ }
+
+Then you can override the methods convertToPhpValueSQL and convertToDatabaseValueSQL :
+
+::
+
+ <?php
+ public function convertToPHPValueSQL($sqlExpr, $platform)
+ {
+ return 'MyMoneyFunction(\''.$sqlExpr.') ';
+ }
+
+ public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
+ {
+ return 'MyFunction('.$sqlExpr.')';
+ }
+
+
Now we have to register this type with the Doctrine Type system and
hook it into the database platform:
Please sign in to comment.
Something went wrong with that request. Please try again.