mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-18 15:11:03 +01:00
Change ValueError (500) to preconditionFailed (412)
This commit is contained in:
parent
8fa5aae1e7
commit
fe06a2a27a
@ -6,6 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
@ -157,7 +158,7 @@ class MapApiController extends AbstractController
|
|||||||
else{
|
else{
|
||||||
$names = new ArrayCollection();
|
$names = new ArrayCollection();
|
||||||
foreach($places[0]->getNames() as $plName) { $names[] = $plName->getName(); }
|
foreach($places[0]->getNames() as $plName) { $names[] = $plName->getName(); }
|
||||||
if ($names->contains($value)) { throw new ValueError('Warning: \''.$value.'\' is already a name for place '.$placeId);}
|
if ($names->contains($value)) { throw new AccessDeniedHttpException('Warning: \''.$value.'\' is already a name for place '.$placeId);}
|
||||||
else {
|
else {
|
||||||
$pN = new PlaceName();
|
$pN = new PlaceName();
|
||||||
$pN->setPlace($places[0]);
|
$pN->setPlace($places[0]);
|
||||||
@ -186,7 +187,7 @@ class MapApiController extends AbstractController
|
|||||||
else{
|
else{
|
||||||
$names = new ArrayCollection();
|
$names = new ArrayCollection();
|
||||||
foreach($places[0]->getRoomUsers() as $rUser) { $names[] = $rUser->getUserName(); }
|
foreach($places[0]->getRoomUsers() as $rUser) { $names[] = $rUser->getUserName(); }
|
||||||
if ($names->contains($value)) { throw new ValueError('Warning: \''.$value.'\' is already a name for place '.$placeId);}
|
if ($names->contains($value)) { throw new AccessDeniedHttpException('Warning: \''.$value.'\' is already a name for place '.$placeId);}
|
||||||
else {
|
else {
|
||||||
$rU = new RoomUserName();
|
$rU = new RoomUserName();
|
||||||
$rU->setPlace($places[0]);
|
$rU->setPlace($places[0]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user