This commit is contained in:
Xes
2025-08-14 22:41:49 +02:00
parent 2de81ccc46
commit 8ce45119b6
39774 changed files with 4309466 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Base class for all connection related errors detected in the driver.
*
* @psalm-immutable
*/
class ConnectionException extends DriverException
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* @psalm-immutable
*/
final class ConnectionLost extends ConnectionException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Base class for all constraint violation related errors detected in the driver.
*
* @psalm-immutable
*/
class ConstraintViolationException extends ServerException
{
}

View File

@@ -0,0 +1,16 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Base class for all already existing database object related errors detected in the driver.
*
* A database object is considered any asset that can be created in a database
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
* functions, stored procedures etc.
*
* @psalm-immutable
*/
class DatabaseObjectExistsException extends ServerException
{
}

View File

@@ -0,0 +1,16 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Base class for all unknown database object related errors detected in the driver.
*
* A database object is considered any asset that can be created in a database
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
* functions, stored procedures etc.
*
* @psalm-immutable
*/
class DatabaseObjectNotFoundException extends ServerException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a deadlock error of a transaction detected in the driver.
*
* @psalm-immutable
*/
class DeadlockException extends ServerException implements RetryableException
{
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\Driver\DriverException as DeprecatedDriverException;
use Doctrine\DBAL\Exception;
/**
* Base class for all errors detected in the driver.
*
* @psalm-immutable
*/
class DriverException extends Exception
{
/**
* The previous DBAL driver exception.
*
* @var DeprecatedDriverException
*/
private $driverException;
/**
* @param string $message The exception message.
* @param DeprecatedDriverException $driverException The DBAL driver exception to chain.
*/
public function __construct($message, DeprecatedDriverException $driverException)
{
parent::__construct($message, 0, $driverException);
$this->driverException = $driverException;
}
/**
* Returns the driver specific error code if given.
*
* Returns null if no error code was given by the driver.
*
* @return int|string|null
*/
public function getErrorCode()
{
return $this->driverException->getErrorCode();
}
/**
* Returns the SQLSTATE the driver was in at the time the error occurred, if given.
*
* Returns null if no SQLSTATE was given by the driver.
*
* @return string|null
*/
public function getSQLState()
{
return $this->driverException->getSQLState();
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a foreign key constraint violation detected in the driver.
*
* @psalm-immutable
*/
class ForeignKeyConstraintViolationException extends ConstraintViolationException
{
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception;
/**
* Exception to be thrown when invalid arguments are passed to any DBAL API
*
* @psalm-immutable
*/
class InvalidArgumentException extends Exception
{
/**
* @return self
*/
public static function fromEmptyCriteria()
{
return new self('Empty criteria was used, expected non-empty criteria');
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for an invalid specified field name in a statement detected in the driver.
*
* @psalm-immutable
*/
class InvalidFieldNameException extends ServerException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a lock wait timeout error of a transaction detected in the driver.
*
* @psalm-immutable
*/
class LockWaitTimeoutException extends ServerException implements RetryableException
{
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception;
use function sprintf;
/**
* @internal
*
* @psalm-immutable
*/
final class NoKeyValue extends Exception
{
public static function fromColumnCount(int $columnCount): self
{
return new self(
sprintf(
'Fetching as key-value pairs requires the result to contain at least 2 columns, %d given.',
$columnCount
)
);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a non-unique/ambiguous specified field name in a statement detected in the driver.
*
* @psalm-immutable
*/
class NonUniqueFieldNameException extends ServerException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a NOT NULL constraint violation detected in the driver.
*
* @psalm-immutable
*/
class NotNullConstraintViolationException extends ConstraintViolationException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a write operation attempt on a read-only database element detected in the driver.
*
* @psalm-immutable
*/
class ReadOnlyException extends ServerException
{
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Doctrine\DBAL\Exception;
use Throwable;
/**
* Marker interface for all exceptions where retrying the transaction makes sense.
*
* @psalm-immutable
*/
interface RetryableException extends Throwable
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Base class for all server related errors detected in the driver.
*
* @psalm-immutable
*/
class ServerException extends DriverException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a syntax error in a statement detected in the driver.
*
* @psalm-immutable
*/
class SyntaxErrorException extends ServerException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for an already existing table referenced in a statement detected in the driver.
*
* @psalm-immutable
*/
class TableExistsException extends DatabaseObjectExistsException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for an unknown table referenced in a statement detected in the driver.
*
* @psalm-immutable
*/
class TableNotFoundException extends DatabaseObjectNotFoundException
{
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Exception;
/**
* Exception for a unique constraint violation detected in the driver.
*
* @psalm-immutable
*/
class UniqueConstraintViolationException extends ConstraintViolationException
{
}