add confirm button for move

This commit is contained in:
2021-06-04 21:24:11 +02:00
parent 48e5809008
commit e5905902cc
6 changed files with 268 additions and 10 deletions

View File

@@ -50,6 +50,49 @@ class HouseholdMemberController extends ApiController
return $this->json($editor->getHousehold(), Response::HTTP_OK, ["groups" => ["read"]]);
}
/**
* @Route(
* "/api/1.0/person/household/members/move/test.{_format}",
* name="chill_api_person_household_members_move_test"
* )
*/
public function test(Request $request, $_format): Response
{
try {
$editor = $this->getSerializer()
->deserialize($request->getContent(), MembersEditor::class,
$_format, ['groups' => [ "read" ]]);
} catch (Exception\InvalidArgumentException | Exception\UnexpectedValueException $e) {
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
}
// TODO ACL
//
// TODO validation
// temporary, to have at least one problem for testing purpose
/*$violations = [
new \Symfony\Component\Validator\ConstraintViolation(
"This is a fake message",
null,
[],
$editor->getHousehold(),
'household.members.startDate',
new \DateTime('10 years ago')
),
new \Symfony\Component\Validator\ConstraintViolation(
"This is another fake message",
null,
[],
$editor->getHousehold(),
'household.members.endDate',
new \DateTime('10 years ago')
)
];
$violationsList = new \Symfony\Component\Validator\ConstraintViolationList($violations);
*/
return $this->json($editor->getHousehold(), Response::HTTP_OK, ["groups" => ["read"]]);
}
/**
* @Route(
* "/{_locale}/person/household/members/editor",