diff --git a/docs/en/reference/types.rst b/docs/en/reference/types.rst index f767d8d12ed..156cad99293 100644 --- a/docs/en/reference/types.rst +++ b/docs/en/reference/types.rst @@ -929,29 +929,25 @@ Now we implement our ``Doctrine\DBAL\Types\Type`` instance: The job of Doctrine-DBAL is to transform your type into an SQL declaration. You can modify the SQL declaration Doctrine will produce. -At first, to enable this feature, you must override the -``canRequireSQLConversion`` method: +At first, to enable this feature, you must implement the +``Doctrine\DBAL\Types\WellKnownTextConverter`` interface: :: . + */ + +namespace Doctrine\DBAL\Types; + +use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\DBALException; + +/** + * Does working with this column require SQL conversion functions? + * + * This is a metadata function that is required for example in the ORM. + * Usage of {@link convertToDatabaseValueSQL} and + * {@link convertToPHPValueSQL} works for any type and mostly + * does nothing. This method can additionally be used for optimization purposes. + * + */ +interface WellKnownTextConverter +{ + /** + * Modifies the SQL expression (identifier, parameter) to convert to a database value. + * + * @param string $sqlExpr + * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform + * + * @return string + */ + public function convertFromWellKnownTextSQL(string $sqlExpr, AbstractPlatform $platform) : string; + + /** + * Modifies the SQL expression (identifier, parameter) to convert to a PHP value. + * + * @param string $sqlExpr + * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform + * + * @return string + */ + public function convertToWellKnownTextSQL(string $sqlExpr, AbstractPlatform $platform) : string; +}