findAllVariables(); return $this->json(['results' => $varList]); } #[Route('/api/config/section', name: 'app_config_sections', methods: ["GET"])] #[OA\Tag(name: "Config")] #[OA\Response( response: 200, description: 'Returns all public config sections.', content: new OA\JsonContent( type: 'object', properties: [ new OA\Property( property: "results", type: "array", items: new OA\Items(type: "string") ) ] ) )] public function getSections(ConfigVariableRepository $repo): Response { $sectionList = $repo->getAllSections(); $returnList = []; foreach ($sectionList as $section) { $sectionValue = $section["section"]; $returnList[] = $sectionValue; } return $this->json(['results' => $returnList]); } #[Route('/api/config/section/{section}', name: 'app_config_variableBySection', methods: ["GET"])] #[OA\Tag(name: "Config")] #[OA\Response( response: 200, description: 'Returns all public config variables for given section.', content: new OA\JsonContent( type: 'object', properties: [ new OA\Property( property: "results", type: "array", items: new OA\Items(ref: new Model(type: ConfigVariable::class)) ) ] ) )] #[OA\Parameter( name: 'section', in: 'path', description: 'Config section.', schema: new OA\Schema(type: 'string') )] public function getVariablesBySection(ConfigVariableRepository $repo, string $section): Response { if(\is_null($section) || $section == '') { throw new ApiErrorException( new ApiErrorMessage(400, ApiErrorMessage::TYPE_INVALID_REQUEST_BODY_FORMAT) ); } $varList = $repo->findAllBySection($section); return $this->json(['results' => $varList]); } #[Route('/api/config/var/{key}', name: 'app_config_variable', methods: ["GET"])] #[OA\Tag(name: "Config")] #[OA\Response( response: 200, description: 'Get config variable by key.', content: new OA\JsonContent( type: 'object', ref: new Model(type: ConfigVariable::class), ) )] #[OA\Parameter( name: 'key', in: 'path', description: 'Variable key.', schema: new OA\Schema(type: 'string') )] public function getByKey(ConfigVariableRepository $repo, string $key): Response { $var = $repo->findVariableByKey($key); return $this->json($var); } }