1
0
mirror of synced 2024-12-13 06:46:03 +03:00

[2.0] DDC-92 - Completly removed DoctrineException in DBAL package

This commit is contained in:
beberlei 2010-02-19 22:43:39 +00:00
parent 07e73880f5
commit d5fd881c27
2 changed files with 21 additions and 5 deletions

View File

@ -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.');
}
}

View File

@ -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;