mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
fixture for addressReference - WIP
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Chill\MainBundle\Entity\AddressReference;
|
||||
|
||||
|
||||
/**
|
||||
* Class AccompanyingCourseController
|
||||
*
|
||||
* @package Chill\PersonBundle\Controller
|
||||
*/
|
||||
class AddressReferenceController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* Get API Data for showing endpoint
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/main/api/1.0/address-reference/{address_reference_id}/show.{_format}",
|
||||
* name="chill_main_address_reference_api_show"
|
||||
* )
|
||||
* @ParamConverter("addressReference", options={"id": "address_reference_id"})
|
||||
*/
|
||||
public function showAPI(AddressReference $addressReference, $_format): Response
|
||||
{
|
||||
// TODO check ACL on AccompanyingPeriod
|
||||
|
||||
$this->dispatcher->dispatch(
|
||||
AccompanyingPeriodPrivacyEvent::ACCOMPANYING_PERIOD_PRIVACY_EVENT,
|
||||
new AccompanyingPeriodPrivacyEvent($addressReference, [
|
||||
'action' => 'showApi'
|
||||
])
|
||||
);
|
||||
|
||||
switch ($_format) {
|
||||
case 'json':
|
||||
return $this->json($addressReference);
|
||||
default:
|
||||
throw new BadRequestException('Unsupported format');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user