Created
April 27, 2021 19:32
-
-
Save erop/8c7fc0f36836db1171152507aa7e52df to your computer and use it in GitHub Desktop.
Controller for exposing document schemas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace App\Controller; | |
use App\Service\DocumentSchemaService; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\HttpFoundation\JsonResponse; | |
use Symfony\Component\Routing\Annotation\Route; | |
final class DocumentSchemaController extends AbstractController | |
{ | |
private DocumentSchemaService $service; | |
public function __construct(DocumentSchemaService $service) | |
{ | |
$this->service = $service; | |
} | |
/** | |
* @Route("/document-schemas", name="app_document_schemas", methods={"GET"}) | |
*/ | |
public function getDocumentSchemas(): JsonResponse | |
{ | |
$schemas = ($this->service)(); | |
return new JsonResponse($schemas); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment