Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4 from julienfastre/master

add documentation for new methods in Doctrine::Type
  • Loading branch information...
commit 3d20e9a5c414a64a0ae8496a23beb4e89245116a 2 parents ed68431 + a645502
Guilherme Blanco 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:
}
}
+The job of Doctrine-DBAL is to transform your type into SQL declaration. You can modify the SQL declaration Doctrine will produce. At first, you must 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.