welcome back to dyb-tech
This commit is contained in:
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class ConnectionLost extends ConnectionException
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class DatabaseDoesNotExist extends DatabaseObjectNotFoundException
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class DatabaseRequired extends Exception
|
||||
{
|
||||
public static function new(string $methodName): self
|
||||
{
|
||||
return new self(sprintf('A database is required for the method: %s.', $methodName));
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
use Doctrine\DBAL\Driver\Exception as TheDriverException;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Query;
|
||||
|
||||
use function assert;
|
||||
|
||||
/**
|
||||
* Base class for all errors detected in the driver.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class DriverException extends Exception implements TheDriverException
|
||||
{
|
||||
/**
|
||||
* The query that triggered the exception, if any.
|
||||
*/
|
||||
private ?Query $query;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @param TheDriverException $driverException The DBAL driver exception to chain.
|
||||
* @param Query|null $query The SQL query that triggered the exception, if any.
|
||||
*/
|
||||
public function __construct(TheDriverException $driverException, ?Query $query)
|
||||
{
|
||||
if ($query !== null) {
|
||||
$message = 'An exception occurred while executing a query: ' . $driverException->getMessage();
|
||||
} else {
|
||||
$message = 'An exception occurred in the driver: ' . $driverException->getMessage();
|
||||
}
|
||||
|
||||
parent::__construct($message, $driverException->getCode(), $driverException);
|
||||
|
||||
$this->query = $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSQLState()
|
||||
{
|
||||
$previous = $this->getPrevious();
|
||||
assert($previous instanceof TheDriverException);
|
||||
|
||||
return $previous->getSQLState();
|
||||
}
|
||||
|
||||
public function getQuery(): ?Query
|
||||
{
|
||||
return $this->query;
|
||||
}
|
||||
}
|
||||
+12
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class InvalidLockMode extends Exception
|
||||
{
|
||||
public static function fromLockMode(int $lockMode): self
|
||||
{
|
||||
return new self(
|
||||
sprintf(
|
||||
'Lock mode %d is invalid. The valid values are LockMode::NONE, LockMode::OPTIMISTIC'
|
||||
. ', LockMode::PESSIMISTIC_READ and LockMode::PESSIMISTIC_WRITE',
|
||||
$lockMode,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class MalformedDsnException extends InvalidArgumentException
|
||||
{
|
||||
public static function new(): self
|
||||
{
|
||||
return new self('Malformed database connection URL');
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\DBAL\Exception;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class SchemaDoesNotExist extends DatabaseObjectNotFoundException
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user