mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
endpoint created for acc periods by-person
This commit is contained in:
@@ -18,7 +18,11 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodACLAwareRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Symfony\Component\Workflow\Registry;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
|
||||
class AccompanyingCourseApiController extends ApiController
|
||||
{
|
||||
@@ -28,14 +32,18 @@ class AccompanyingCourseApiController extends ApiController
|
||||
|
||||
private Registry $registry;
|
||||
|
||||
private AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository;
|
||||
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ValidatorInterface $validator,
|
||||
Registry $registry
|
||||
Registry $registry,
|
||||
AccompanyingPeriodACLAwareRepository $accompanyingPeriodACLAwareRepository
|
||||
) {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->validator = $validator;
|
||||
$this->registry = $registry;
|
||||
$this->accompanyingPeriodACLAwareRepository = $accompanyingPeriodACLAwareRepository;
|
||||
}
|
||||
|
||||
public function confirmApi($id, Request $request, $_format): Response
|
||||
@@ -187,4 +195,19 @@ $workflow = $this->registry->get($accompanyingPeriod);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/api/1.0/person/accompanying-course/by-person/{person_id}.{_format}",
|
||||
* name="chill_person_accompanyingperiod_by_person",
|
||||
* requirements={
|
||||
* "_format"="json"
|
||||
* })
|
||||
*
|
||||
* @ParamConverter("person", options={"id" = "person_id"})
|
||||
*/
|
||||
public function getAccompanyingPeriodsByPerson(Person $person){
|
||||
$accompanyingPeriods = $person->getAccompanyingPeriods();
|
||||
return $this->json(\array_values($accompanyingPeriods), Response::HTTP_OK, [], ['groups' => [ 'read']]);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user