feat: ajout des 3 derniers WS en lecture du bundle malio ednotif (!47)
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
- 3 nouveaux endpoints API Platform pass-through sur /api/bovins/{inventory|returned-dossiers|presumed-exits} consommant BovinApiInterface v0.0.6
- AnimalSummaryMapper (src/Service/) factorisant le mapping DTO EDNOTIF -> ressource
- src/State/ réorganisé par domaine (Bovin/, Reception/, Shipment/, Building/, User/, System/)
- tag OpenAPI "Bovins" pour regrouper les endpoints ednotif dans Swagger
- malio/ednotif-bundle passé à v0.0.6
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
| | |
## Description de la PR
## Modification du .env
## Check list
- [ ] Pas de régression
- [ ] TU/TI/TF rédigée
- [ ] TU/TI/TF OK
- [ ] CHANGELOG modifié
Reviewed-on: #47
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #47.
This commit is contained in:
53
src/Service/AnimalSummaryMapper.php
Normal file
53
src/Service/AnimalSummaryMapper.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\ApiResource\AnimalSummary;
|
||||
use App\ApiResource\PresencePeriod;
|
||||
use Malio\EdnotifBundle\Bovin\Dto\AnimalSummaryDto;
|
||||
|
||||
final class AnimalSummaryMapper
|
||||
{
|
||||
public function map(AnimalSummaryDto $dto): AnimalSummary
|
||||
{
|
||||
$summary = new AnimalSummary();
|
||||
|
||||
$identification = $dto->identification;
|
||||
|
||||
$summary->countryCode = $identification?->bovin?->countryCode;
|
||||
$summary->nationalNumber = $identification?->bovin?->nationalNumber;
|
||||
|
||||
$summary->sex = $identification?->sex;
|
||||
$summary->breedType = $identification?->breedType;
|
||||
$summary->workNumber = $identification?->workNumber;
|
||||
|
||||
$summary->birthDate = $identification?->birthDate?->date?->format('Y-m-d');
|
||||
$summary->birthDateCompletenessFlag = $identification?->birthDate?->completenessFlag;
|
||||
|
||||
$summary->isFilie = $identification?->isFilie;
|
||||
|
||||
$summary->motherNationalNumber = $identification?->motherCarrier?->bovin?->nationalNumber;
|
||||
$summary->motherBreedType = $identification?->motherCarrier?->breedType;
|
||||
|
||||
$summary->fatherNationalNumber = $identification?->fatherIpg?->bovin?->nationalNumber;
|
||||
$summary->fatherBreedType = $identification?->fatherIpg?->breedType;
|
||||
|
||||
$summary->birthExploitationNumber = $identification?->birthExploitation?->exploitationNumber;
|
||||
|
||||
foreach ($dto->presencePeriods as $presencePeriodDto) {
|
||||
$presencePeriod = new PresencePeriod();
|
||||
|
||||
$presencePeriod->entryDate = $presencePeriodDto->entry?->date?->format('Y-m-d');
|
||||
$presencePeriod->entryCause = $presencePeriodDto->entry?->cause;
|
||||
|
||||
$presencePeriod->exitDate = $presencePeriodDto->exit?->date?->format('Y-m-d');
|
||||
$presencePeriod->exitCause = $presencePeriodDto->exit?->cause;
|
||||
|
||||
$summary->presencePeriods[] = $presencePeriod;
|
||||
}
|
||||
|
||||
return $summary;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user