Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Cache][Doctrine][DoctrineBridge][Lock][Messenger] Remove references to DBALException #43311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"doctrine/cache": "^1.11|^2.0",
"doctrine/collections": "~1.0",
"doctrine/data-fixtures": "^1.1",
"doctrine/dbal": "^2.10|^3.0",
"doctrine/dbal": "^2.13|^3.0",
"doctrine/orm": "^2.7.3",
"guzzlehttp/promises": "^1.4",
"masterminds/html5": "^2.6",
Expand All @@ -155,7 +155,7 @@
"ext-psr": "<1.1|>=2",
"async-aws/core": "<1.5",
"doctrine/annotations": "<1.13.1",
"doctrine/dbal": "<2.10",
"doctrine/dbal": "<2.13",
"egulias/email-validator": "~3.0.0",
"masterminds/html5": "<2.6",
"phpdocumentor/reflection-docblock": "<3.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

namespace Symfony\Bridge\Doctrine\Messenger;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Middleware\StackInterface;
Expand Down Expand Up @@ -40,7 +39,7 @@ private function pingConnection(EntityManagerInterface $entityManager)

try {
$connection->executeQuery($connection->getDatabasePlatform()->getDummySelectSQL());
} catch (DBALException | Exception $e) {
} catch (DBALException $e) {
$connection->close();
$connection->connect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
namespace Symfony\Bridge\Doctrine\Tests\Messenger;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware;
Expand Down Expand Up @@ -50,7 +49,7 @@ public function testMiddlewarePingOk()
{
$this->connection->expects($this->once())
->method('getDatabasePlatform')
->will($this->throwException(class_exists(Exception::class) ? new Exception() : new DBALException()));
->will($this->throwException(new DBALException()));

$this->connection->expects($this->once())
->method('close')
Expand All @@ -69,7 +68,7 @@ public function testMiddlewarePingResetEntityManager()
{
$this->connection->expects($this->once())
->method('getDatabasePlatform')
->will($this->throwException(class_exists(Exception::class) ? new Exception() : new DBALException()));
->will($this->throwException(new DBALException()));

$this->entityManager->expects($this->once())
->method('isOpen')
Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"doctrine/annotations": "^1.10.4",
"doctrine/collections": "~1.0",
"doctrine/data-fixtures": "^1.1",
"doctrine/dbal": "^2.10|^3.0",
"doctrine/dbal": "^2.13|^3.0",
"doctrine/orm": "^2.7.3"
},
"conflict": {
"doctrine/dbal": "<2.10",
"doctrine/dbal": "<2.13",
"doctrine/orm": "<2.7.3",
"phpunit/phpunit": "<5.4.3",
"symfony/dependency-injection": "<4.4",
Expand Down
6 changes: 2 additions & 4 deletions 6 src/Symfony/Component/Cache/Adapter/PdoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
namespace Symfony\Component\Cache\Adapter;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\Schema;
Expand Down Expand Up @@ -110,7 +109,6 @@ public function __construct($connOrDsn, string $namespace = '', int $defaultLife
*
* @throws \PDOException When the table already exists
* @throws DBALException When the table already exists
* @throws Exception When the table already exists
* @throws \DomainException When an unsupported PDO driver is used
*/
public function createTable()
Expand Down Expand Up @@ -437,7 +435,7 @@ protected function doSave(array $values, int $lifetime)
if (null === $driver && !(\is_object($result) ? $result->rowCount() : $stmt->rowCount())) {
try {
$insertStmt->execute();
} catch (DBALException | Exception $e) {
} catch (DBALException $e) {
} catch (\PDOException $e) {
// A concurrent write won, let it be
}
Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/Cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/cache": "^1.6|^2.0",
"doctrine/dbal": "^2.10|^3.0",
"doctrine/dbal": "^2.13|^3.0",
"predis/predis": "^1.1",
"psr/simple-cache": "^1.0",
"symfony/config": "^4.4|^5.0|^6.0",
Expand All @@ -45,7 +45,7 @@
"symfony/var-dumper": "^4.4|^5.0|^6.0"
},
"conflict": {
"doctrine/dbal": "<2.10",
"doctrine/dbal": "<2.13",
"symfony/dependency-injection": "<4.4",
"symfony/http-kernel": "<4.4",
"symfony/var-dumper": "<4.4"
Expand Down
6 changes: 2 additions & 4 deletions 6 src/Symfony/Component/Lock/Store/PdoStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
namespace Symfony\Component\Lock\Store;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -144,7 +143,7 @@ public function save(Key $key)
$this->createTable();
}
$stmt->execute();
} catch (DBALException | Exception $e) {
} catch (DBALException $e) {
// the lock is already acquired. It could be us. Let's try to put off.
$this->putOffExpiration($key, $this->initialTtl);
} catch (\PDOException $e) {
Expand Down Expand Up @@ -258,7 +257,6 @@ private function getConnection(): object
*
* @throws \PDOException When the table already exists
* @throws DBALException When the table already exists
* @throws Exception When the table already exists
* @throws \DomainException When an unsupported PDO driver is used
*/
public function createTable(): void
Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/Lock/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"symfony/polyfill-php80": "^1.16"
},
"require-dev": {
"doctrine/dbal": "^2.10|^3.0",
"doctrine/dbal": "^2.13|^3.0",
"mongodb/mongodb": "~1.1",
"predis/predis": "~1.0"
},
"conflict": {
"doctrine/dbal": "<2.10"
"doctrine/dbal": "<2.13"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Lock\\": "" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
use Doctrine\DBAL\Abstraction\Result as AbstractionResult;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
Expand Down Expand Up @@ -100,12 +99,7 @@ public function testItThrowsATransportExceptionIfItCannotAcknowledgeMessage()
{
$this->expectException(TransportException::class);
$driverConnection = $this->getDBALConnectionMock();

if (class_exists(Exception::class)) {
$driverConnection->method('delete')->willThrowException(new Exception());
} else {
$driverConnection->method('delete')->willThrowException(new DBALException());
}
$driverConnection->method('delete')->willThrowException(new DBALException());

$connection = new Connection([], $driverConnection);
$connection->ack('dummy_id');
Expand All @@ -115,12 +109,7 @@ public function testItThrowsATransportExceptionIfItCannotRejectMessage()
{
$this->expectException(TransportException::class);
$driverConnection = $this->getDBALConnectionMock();

if (class_exists(Exception::class)) {
$driverConnection->method('delete')->willThrowException(new Exception());
} else {
$driverConnection->method('delete')->willThrowException(new DBALException());
}
$driverConnection->method('delete')->willThrowException(new DBALException());

$connection = new Connection([], $driverConnection);
$connection->reject('dummy_id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;

use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\MySqlPlatform;
Expand Down Expand Up @@ -118,8 +117,7 @@ public static function buildConfiguration(string $dsn, array $options = []): arr
*
* @return string The inserted id
*
* @throws \Doctrine\DBAL\DBALException
* @throws \Doctrine\DBAL\Exception
* @throws DBALException
*/
public function send(string $body, array $headers, int $delay = 0): string
{
Expand Down Expand Up @@ -227,7 +225,7 @@ public function ack(string $id): bool
{
try {
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -236,7 +234,7 @@ public function reject(string $id): bool
{
try {
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Exception\RetryableException;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\LogicException;
Expand Down Expand Up @@ -59,7 +58,7 @@ public function get(): iterable
}

return [];
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand All @@ -77,7 +76,7 @@ public function ack(Envelope $envelope): void
{
try {
$this->connection->ack($this->findDoctrineReceivedStamp($envelope)->getId());
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -89,7 +88,7 @@ public function reject(Envelope $envelope): void
{
try {
$this->connection->reject($this->findDoctrineReceivedStamp($envelope)->getId());
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -101,7 +100,7 @@ public function getMessageCount(): int
{
try {
return $this->connection->getMessageCount();
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}
}
Expand All @@ -113,7 +112,7 @@ public function all(int $limit = null): iterable
{
try {
$doctrineEnvelopes = $this->connection->findAll($limit);
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand All @@ -129,7 +128,7 @@ public function find($id): ?Envelope
{
try {
$doctrineEnvelope = $this->connection->find($id);
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Exception as DBALException;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\TransportException;
use Symfony\Component\Messenger\Stamp\DelayStamp;
Expand Down Expand Up @@ -48,7 +47,7 @@ public function send(Envelope $envelope): Envelope

try {
$id = $this->connection->send($encodedMessage['body'], $encodedMessage['headers'] ?? [], $delay);
} catch (DBALException | Exception $exception) {
} catch (DBALException $exception) {
throw new TransportException($exception->getMessage(), 0, $exception);
}

Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"symfony/service-contracts": "^1.1|^2"
},
"require-dev": {
"doctrine/dbal": "^2.10|^3.0",
"doctrine/dbal": "^2.13|^3.0",
"doctrine/persistence": "^1.3|^2",
"symfony/property-access": "^4.4|^5.0|^6.0",
"symfony/serializer": "^4.4|^5.0|^6.0"
},
"conflict": {
"doctrine/dbal": "<2.10",
"doctrine/dbal": "<2.13",
"doctrine/persistence": "<1.3"
},
"autoload": {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.