requireRole($this->security, 'ROLE_VIEWER'); if (!in_array($entityType, self::VALID_TYPES, true)) { $this->mcpError('Validation', sprintf( 'Invalid entityType "%s". Must be one of: %s', $entityType, implode(', ', self::VALID_TYPES), )); } $logs = $this->auditLogs->findEntityHistory($entityType, $entityId, 200); $items = array_map( static fn ($log) => [ 'id' => $log->getId(), 'action' => $log->getAction(), 'diff' => $log->getDiff(), 'actorProfileId' => $log->getActorProfileId(), 'createdAt' => $log->getCreatedAt()->format(DateTimeInterface::ATOM), ], $logs, ); return $this->jsonResponse([ 'items' => array_values($items), 'total' => count($items), ]); } }