Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / DbalTypes / NegativeToPositiveType.php
1 <?php
2
3 namespace Doctrine\Tests\DbalTypes;
4
5 use Doctrine\DBAL\Types\Type;
6 use Doctrine\DBAL\Platforms\AbstractPlatform;
7
8 class NegativeToPositiveType extends Type
9 {
10     public function getName()
11     {
12         return 'negative_to_positive';
13     }
14
15     public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
16     {
17         return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration);
18     }
19
20     public function canRequireSQLConversion()
21     {
22         return true;
23     }
24
25     public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
26     {
27         return 'ABS(' . $sqlExpr . ')';
28     }
29
30     public function convertToPHPValueSQL($sqlExpr, $platform)
31     {
32         return '-(' . $sqlExpr . ')';
33     }
34 }