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
POST http://localhost:8000/api/documents | |
Content-Type: application/json | |
{ | |
"payload": { | |
"type": "passport", | |
"firstName": "Ivan", | |
"lastName": "Ivanov", | |
"citizenship": "Russia", | |
"series": "XC", |
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 | |
namespace App\Annotation; | |
use Doctrine\Common\Annotations\Annotation; | |
use Doctrine\Common\Annotations\Annotation\Target; | |
/** | |
* @Annotation | |
* @Target("PROPERTY") |
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\DocumentType; | |
use App\Annotation\DocumentField; | |
final class Passport implements IDocument | |
{ | |
/** |
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
services: | |
#... | |
_instanceof: | |
App\DocumentType\IDocument: | |
tags: ['app.idocument'] | |
#... | |
App\Service\DocumentSchemaService: | |
arguments: | |
- !tagged_iterator app.idocument |
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\Service; | |
use App\Annotation\DocumentField; | |
use App\DocumentType\IDocument; | |
use Doctrine\Common\Annotations\AnnotationReader; | |
final class DocumentSchemaService |
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; |
OlderNewer