em->getConnection()->executeQuery('SELECT 1'); $checks['database'] = 'ok'; } catch (\Throwable) { $checks['database'] = 'error'; $status = 'degraded'; } try { $item = $this->cache->getItem('health_check'); $checks['redis'] = 'ok'; } catch (\Throwable) { $checks['redis'] = 'error'; $status = 'degraded'; } return new JsonResponse([ 'status' => $status, 'checks' => $checks, 'timestamp' => time(), ], $status === 'ok' ? 200 : 503); } }