Changed mechanism to determine if connection to database worked for health endpoint

This commit is contained in:
Alejandro Celaya
2021-10-23 13:36:27 +02:00
parent c7a621cb31
commit a4fde0f9e6
2 changed files with 16 additions and 28 deletions

View File

@@ -32,7 +32,9 @@ class HealthAction extends AbstractRestAction
public function handle(ServerRequestInterface $request): ResponseInterface
{
try {
$connected = $this->em->getConnection()->isConnected();
$connection = $this->em->getConnection();
$connection->executeQuery($connection->getDatabasePlatform()->getDummySelectSQL());
$connected = true;
} catch (Throwable) {
$connected = false;
}