From d5fd881c27868cbedf2e0ac88238e93d9fa60afc Mon Sep 17 00:00:00 2001
From: beberlei <beberlei@625475ce-881a-0410-a577-b389adb331d8>
Date: Fri, 19 Feb 2010 22:43:39 +0000
Subject: [PATCH] [2.0] DDC-92 - Completly removed DoctrineException in DBAL
 package

---
 lib/Doctrine/DBAL/DBALException.php | 15 +++++++++++++++
 lib/Doctrine/DBAL/Types/Type.php    | 11 ++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/lib/Doctrine/DBAL/DBALException.php b/lib/Doctrine/DBAL/DBALException.php
index 8d29c310f..9222e7e20 100644
--- a/lib/Doctrine/DBAL/DBALException.php
+++ b/lib/Doctrine/DBAL/DBALException.php
@@ -70,4 +70,19 @@ class DBALException extends \Exception
     {
         return new self("Invalid Offset in Limit Query, it has to be larger or equal to 0.");
     }
+
+    public static function typeExists($name)
+    {
+        return new self('Type '.$name.' already exists.');
+    }
+
+    public static function unknownColumnType($name)
+    {
+        return new self('Unknown column type '.$name.' requested.');
+    }
+
+    public static function typeNotFound($name)
+    {
+        return new self('Type to be overwritten '.$name.' does not exist.');
+    }
 }
\ No newline at end of file
diff --git a/lib/Doctrine/DBAL/Types/Type.php b/lib/Doctrine/DBAL/Types/Type.php
index 4c5eac92a..7b2c08230 100644
--- a/lib/Doctrine/DBAL/Types/Type.php
+++ b/lib/Doctrine/DBAL/Types/Type.php
@@ -115,6 +115,7 @@ abstract class Type
      * Type instances are implemented as flyweights.
      *
      * @static
+     * @throws DBALException
      * @param string $name The name of the type (as returned by getName()).
      * @return Doctrine\DBAL\Types\Type
      */
@@ -122,7 +123,7 @@ abstract class Type
     {
         if ( ! isset(self::$_typeObjects[$name])) {
             if ( ! isset(self::$_typesMap[$name])) {
-                throw DoctrineException::unknownColumnType($name);
+                throw DBALException::unknownColumnType($name);
             }
             
             self::$_typeObjects[$name] = new self::$_typesMap[$name]();
@@ -138,12 +139,12 @@ abstract class Type
      * @param string $name Name of the type. This should correspond to what
      *                           getName() returns.
      * @param string $className The class name of the custom type.
-     * @throws DoctrineException
+     * @throws DBALException
      */
     public static function addType($name, $className)
     {
         if (isset(self::$_typesMap[$name])) {
-            throw DoctrineException::typeExists($name);
+            throw DBALException::typeExists($name);
         }
         
         self::$_typesMap[$name] = $className;
@@ -167,12 +168,12 @@ abstract class Type
      * @static
      * @param string $name
      * @param string $className
-     * @throws DoctrineException
+     * @throws DBALException
      */
     public static function overrideType($name, $className)
     {
         if ( ! isset(self::$_typesMap[$name])) {
-            throw DoctrineException::typeNotFound($name);
+            throw DBALException::typeNotFound($name);
         }
         
         self::$_typesMap[$name] = $className;
-- 
2.21.0