Skip to content

Commit

Permalink
Fix PUT for PAM Rapport.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienTouze committed Aug 26, 2022
1 parent d458301 commit 0153383
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/Service/PAM/RapportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ public function updateRapport(FormInterface $form, Request $request, PamRapport
/** @var PamRapport $rapport */
$rapport = $this->serializer->deserialize($request->getContent(), PamRapport::class, 'json'); // Mapping de la request en entity PamRapport

$existingRapport->setStartDatetime($rapport->getStartDatetime());
$existingRapport->setEndDatetime($rapport->getEndDatetime());
if($rapport->getStartDatetime()) {
$existingRapport->setStartDatetime($rapport->getStartDatetime());
}
if($rapport->getEndDatetime()) {
$existingRapport->setEndDatetime($rapport->getEndDatetime());
}

if($rapport->getEquipage()) {
$this->setAgent($rapport->getEquipage(), $service);
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Controller/PAM/RapportControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testRapportUpdateInformationsGeneralesSuccess()

$json = $this->jsonReader('body-test-rapport-update-informationsGenerales-success.json');
$this->sendRequest('/rapport/' . $id, $json, 'PUT');

$this->assertEquals(200, $this->client->getResponse()->getStatusCode());

/** @var PamRapport $updatedRapport */
$updatedRapport = $container->get(PamRapportRepository::class)->find($id);
Expand Down

0 comments on commit 0153383

Please sign in to comment.