getContent(), true); $theme = $body['theme'] ?? null; if (!is_string($theme) || !in_array($theme, self::VALID_THEMES, true)) { return $this->json(['error' => 'Invalid theme'], Response::HTTP_UNPROCESSABLE_ENTITY); } /** @var User $user */ $user = $this->getUser(); $user->setTheme($theme); $em->flush(); return $this->json(['theme' => $theme]); } }