mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Merge remote-tracking branch 'origin/master' into issue230_person
This commit is contained in:
@@ -21,7 +21,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
use function array_filter;
|
||||
use function array_values;
|
||||
|
||||
@@ -76,14 +76,6 @@ class PersonApiController extends ApiController
|
||||
return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]);
|
||||
}
|
||||
|
||||
protected function createEntity(string $action, Request $request): object
|
||||
{
|
||||
return parent::createEntity($action, $request);
|
||||
// TODO temporary hack to allow creation of person with fake center
|
||||
/* $centers = $this->authorizationHelper->getReachableCenters($this->getUser(),
|
||||
new Role(PersonVoter::CREATE));
|
||||
$person->setCenter($centers[0]); */
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/person/config/alt_names.{_format}",
|
||||
@@ -120,17 +112,4 @@ class PersonApiController extends ApiController
|
||||
return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]);
|
||||
}
|
||||
|
||||
protected function getValidationGroups(string $action, Request $request, string $_format, $entity): ?array
|
||||
{
|
||||
if ($action === '_entity'){
|
||||
if ($request->getMethod() === Request::METHOD_POST){
|
||||
return ["creation"];
|
||||
}
|
||||
if (($request->getMethod() === Request::METHOD_PATCH) || ($request->getMethod() === Request::METHOD_PUT)){
|
||||
return ["general"];
|
||||
}
|
||||
};
|
||||
return parent::getValidationGroups($action, $request, $_format, $entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user