em = $entityManager; } /** * This function is executed every 5 seconds. * * For more advanced functionality, try injecting a Topic Service to perform actions on your connections every x seconds. */ public function tick() { try { $connection = $this->em->getConnection(); if (false === $connection->ping()) { $connection->close(); $connection->connect(); } } catch(PDOException $ex) { throw PDOException::class; } } /** * {@inheritdoc} */ public function getTimeout() { return 777; } }