Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / orm / tests / Doctrine / Tests / DbalTypes / NegativeToPositiveType.php
diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php b/vendor/doctrine/orm/tests/Doctrine/Tests/DbalTypes/NegativeToPositiveType.php
new file mode 100644 (file)
index 0000000..ae704f8
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace Doctrine\Tests\DbalTypes;
+
+use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
+
+class NegativeToPositiveType extends Type
+{
+    public function getName()
+    {
+        return 'negative_to_positive';
+    }
+
+    public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
+    {
+        return $platform->getIntegerTypeDeclarationSQL($fieldDeclaration);
+    }
+
+    public function canRequireSQLConversion()
+    {
+        return true;
+    }
+
+    public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
+    {
+        return 'ABS(' . $sqlExpr . ')';
+    }
+
+    public function convertToPHPValueSQL($sqlExpr, $platform)
+    {
+        return '-(' . $sqlExpr . ')';
+    }
+}