Skip to content
Open
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
23 changes: 23 additions & 0 deletions src/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@

public function reset(): void
{
foreach ($this->getManagerNames() as $managerName => $serviceId) {

Check failure on line 36 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (PHP: 8.4)

Expected 1 line after "foreach", found 0.
$this->resetOrClearManager($managerName, $serviceId);
}
foreach ($this->getConnectionNames() as $connectionName => $serviceId) {
$this->resetPrimaryReadReplicaConnection($connectionName, $serviceId);
}
}

private function resetOrClearManager(string $managerName, string $serviceId): void
Expand Down Expand Up @@ -73,4 +76,24 @@

$this->resetManager($managerName);
}

private function resetPrimaryReadReplicaConnection(string $connectionName, string $serviceId): void
{
if (! $this->container->initialized($serviceId)) {
return;
}

$connection = $this->container->get($serviceId);

assert($connection instanceof Connection);

Check failure on line 88 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (PHP: 8.4)

Class Doctrine\Bundle\DoctrineBundle\Connection not found.

Check failure on line 89 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (PHP: 8.4)

Functions must not contain multiple empty lines in a row; found 2 empty lines

if (! $connection instanceof PrimaryReadReplicaConnection) {

Check failure on line 91 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (PHP: 8.4)

Class Doctrine\Bundle\DoctrineBundle\PrimaryReadReplicaConnection not found.
return;
}

if (true === $connection->isConnectedToPrimary()) {

Check failure on line 95 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (PHP: 8.4)

Yoda comparisons are disallowed.

Check failure on line 95 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (PHP: 8.4)

Use early exit to reduce code nesting.

Check failure on line 95 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (PHP: 8.4)

Call to method isConnectedToPrimary() on an unknown class Doctrine\Bundle\DoctrineBundle\PrimaryReadReplicaConnection.

Check failure on line 95 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (PHP: 8.4)

Call to method isConnectedToPrimary() on an unknown class Doctrine\Bundle\DoctrineBundle\Connection.
$connection->ensureConnectedToReplica();

Check failure on line 96 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (PHP: 8.4)

Call to method ensureConnectedToReplica() on an unknown class Doctrine\Bundle\DoctrineBundle\PrimaryReadReplicaConnection.

Check failure on line 96 in src/Registry.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (PHP: 8.4)

Call to method ensureConnectedToReplica() on an unknown class Doctrine\Bundle\DoctrineBundle\Connection.
}
}
}
Loading