Skip to content

Commit

Permalink
core: replaced ping method that used to check that dfb connection was…
Browse files Browse the repository at this point in the history
… alive

related to: doctrine/dbal/pull/4119
  • Loading branch information
mmadariaga committed Mar 25, 2022
1 parent 6feb21b commit 11b4914
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Services;

use Doctrine\DBAL\Exception\ConnectionLost;
use Doctrine\ORM\EntityManagerInterface;
use Ivoz\Provider\Domain\Model\Administrator\AdministratorInterface;
use Ivoz\Provider\Domain\Model\Administrator\AdministratorRepository;
Expand Down Expand Up @@ -36,8 +37,9 @@ public function criteriaToString(
array $registerCriteria
) {
$connection = $this->em->getConnection();
$pingError = !$connection->ping();
if ($pingError) {
try {
$connection->executeStatement('SELECT 1');
} catch (ConnectionLost $e) {
$connection->close();
$connection->connect();
}
Expand Down

0 comments on commit 11b4914

Please sign in to comment.