mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Create gender API and adjust serialization of gender property
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class GenderApiController extends ApiController
|
||||
{
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
||||
{
|
||||
return $query->addOrderBy('e.order', 'ASC');
|
||||
}
|
||||
}
|
@@ -17,6 +17,7 @@ use Chill\MainBundle\Controller\CivilityApiController;
|
||||
use Chill\MainBundle\Controller\CivilityController;
|
||||
use Chill\MainBundle\Controller\CountryApiController;
|
||||
use Chill\MainBundle\Controller\CountryController;
|
||||
use Chill\MainBundle\Controller\GenderApiController;
|
||||
use Chill\MainBundle\Controller\GenderController;
|
||||
use Chill\MainBundle\Controller\GeographicalUnitApiController;
|
||||
use Chill\MainBundle\Controller\LanguageController;
|
||||
@@ -813,6 +814,21 @@ class ChillMainExtension extends Extension implements
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => Gender::class,
|
||||
'name' => 'gender',
|
||||
'base_path' => '/api/1.0/main/gender',
|
||||
'base_role' => 'ROLE_USER',
|
||||
'controller' => GenderApiController::class,
|
||||
'actions' => [
|
||||
'_index' => [
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'class' => GeographicalUnitLayer::class,
|
||||
'controller' => GeographicalUnitApiController::class,
|
||||
|
@@ -6,7 +6,7 @@ use Chill\MainBundle\Repository\GenderRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
|
||||
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_main_gender' => Gender::class])]
|
||||
#[ORM\Entity(repositoryClass: GenderRepository::class)]
|
||||
#[ORM\Table(name: 'chill_main_gender')]
|
||||
class Gender
|
||||
|
Reference in New Issue
Block a user