mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/master' into issue566_commentaire_fonctionnalites
This commit is contained in:
@@ -33,10 +33,10 @@ use DateInterval;
|
||||
use DateTimeImmutable;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||
@@ -185,7 +185,7 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
->deserialize($request->getContent(), Person::class, $_format, []);
|
||||
|
||||
if (null === $person) {
|
||||
throw new BadRequestException('person id not found');
|
||||
throw new BadRequestHttpException('person id not found');
|
||||
}
|
||||
|
||||
// TODO add acl
|
||||
@@ -204,7 +204,7 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BadRequestException('This method is not supported');
|
||||
throw new BadRequestHttpException('This method is not supported');
|
||||
}
|
||||
|
||||
$errors = $this->validator->validate($accompanyingPeriod);
|
||||
@@ -247,12 +247,12 @@ final class AccompanyingCourseApiController extends ApiController
|
||||
}
|
||||
|
||||
if (null === $requestor) {
|
||||
throw new BadRequestException('Could not find any person or thirdparty', 0, null);
|
||||
throw new BadRequestHttpException('Could not find any person or thirdparty', 0, null);
|
||||
}
|
||||
|
||||
$accompanyingPeriod->setRequestor($requestor);
|
||||
} else {
|
||||
throw new BadRequestException('method not supported');
|
||||
throw new BadRequestHttpException('method not supported');
|
||||
}
|
||||
|
||||
$errors = $this->validator->validate($accompanyingPeriod);
|
||||
|
@@ -21,9 +21,9 @@ use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationInterface;
|
||||
@@ -255,7 +255,7 @@ class AccompanyingCourseController extends Controller
|
||||
$personIds = $request->query->get('person_id');
|
||||
|
||||
if (false === is_array($personIds)) {
|
||||
throw new BadRequestException('person_id parameter should be an array');
|
||||
throw new BadRequestHttpException('person_id parameter should be an array');
|
||||
}
|
||||
|
||||
foreach ($personIds as $personId) {
|
||||
|
@@ -21,8 +21,8 @@ use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
@@ -202,7 +202,7 @@ class HouseholdController extends AbstractController
|
||||
$this->denyAccessUnlessGranted(HouseholdVoter::EDIT, $household);
|
||||
|
||||
if (!$request->query->has('address_id')) {
|
||||
throw new BadRequestException('parameter address_id is missing');
|
||||
throw new BadRequestHttpException('parameter address_id is missing');
|
||||
}
|
||||
|
||||
$address_id = $request->query->getInt('address_id');
|
||||
@@ -218,7 +218,7 @@ class HouseholdController extends AbstractController
|
||||
}
|
||||
|
||||
if (null === $address) {
|
||||
throw new BadRequestException('The edited address does not belongs to the household');
|
||||
throw new BadRequestHttpException('The edited address does not belongs to the household');
|
||||
}
|
||||
|
||||
$form = $this->createForm(AddressDateType::class, $address, []);
|
||||
|
@@ -20,9 +20,9 @@ use Chill\PersonBundle\Form\HouseholdMemberType;
|
||||
use Chill\PersonBundle\Household\MembersEditor;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Serializer\Exception;
|
||||
@@ -105,7 +105,7 @@ class HouseholdMemberController extends ApiController
|
||||
$ids = $request->query->get('persons', []);
|
||||
|
||||
if (0 === count($ids)) {
|
||||
throw new BadRequestException('parameters persons in query ' .
|
||||
throw new BadRequestHttpException('parameters persons in query ' .
|
||||
'is not an array or empty');
|
||||
}
|
||||
|
||||
@@ -121,7 +121,8 @@ class HouseholdMemberController extends ApiController
|
||||
}
|
||||
}
|
||||
|
||||
if ($householdId = $request->query->get('household', false)) {
|
||||
if ($request->query->has('household')) {
|
||||
$householdId = $request->query->get('household', false);
|
||||
$household = $em->getRepository(Household::class)
|
||||
->find($householdId);
|
||||
$allowHouseholdCreate = false;
|
||||
@@ -189,7 +190,7 @@ class HouseholdMemberController extends ApiController
|
||||
['groups' => ['read']]
|
||||
);
|
||||
} catch (Exception\InvalidArgumentException|Exception\UnexpectedValueException $e) {
|
||||
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
|
||||
throw new BadRequestHttpException("Deserialization error: {$e->getMessage()}", 45896, $e);
|
||||
}
|
||||
|
||||
// TODO ACL
|
||||
|
Reference in New Issue
Block a user