Use json endpoint for showing address with Vuejs Components (WIP)

This commit is contained in:
nobohan
2021-05-03 17:16:45 +02:00
parent 1587c762f8
commit ce859697b5
10 changed files with 241 additions and 22 deletions

View File

@@ -7,17 +7,39 @@ 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\Address;
use Chill\MainBundle\Entity\AddressReference;
/**
* Class AccompanyingCourseController
* Class AddressController
*
* @package Chill\PersonBundle\Controller
* @package Chill\MainBundle\Controller
*/
class AddressReferenceController extends AbstractController
class AddressController extends AbstractController
{
/**
* Get API Data for showing endpoint
*
* @Route(
* "/{_locale}/main/api/1.0/address/{address_id}/show.{_format}",
* name="chill_main_address_api_show"
* )
* @ParamConverter("address", options={"id": "address_id"})
*/
public function showAddress(Address $address, $_format): Response
{
// TODO check ACL ?
switch ($_format) {
case 'json':
return $this->json($address);
default:
throw new BadRequestException('Unsupported format');
}
}
/**
* Get API Data for showing endpoint
*
@@ -27,17 +49,9 @@ class AddressReferenceController extends AbstractController
* )
* @ParamConverter("addressReference", options={"id": "address_reference_id"})
*/
public function showAPI(AddressReference $addressReference, $_format): Response
public function showAddressReference(AddressReference $addressReference, $_format): Response
{
// TODO check ACL on AccompanyingPeriod
$this->dispatcher->dispatch(
AccompanyingPeriodPrivacyEvent::ACCOMPANYING_PERIOD_PRIVACY_EVENT,
new AccompanyingPeriodPrivacyEvent($addressReference, [
'action' => 'showApi'
])
);
// TODO check ACL ?
switch ($_format) {
case 'json':
return $this->json($addressReference);