Commit 3d20e9a5 authored by Guilherme Blanco's avatar Guilherme Blanco

Merge pull request #4 from julienfastre/master

add documentation for new methods in Doctrine::Type
parents ed68431f a6455020
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment