src/Entity/Reference/ReferenceCandidateStatus.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Reference;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\Reference\ReferenceCandidateStatusRepository;
  5. use App\Traits\RankTrait;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ApiResource(
  10.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  11.  *     normalizationContext={"groups"={"reference-candidate-status:read"}, "swagger_definition_name"="Read"},
  12.  *     denormalizationContext={"groups"={"reference-candidate-status:write"}, "swagger_definition_name"="Write"},
  13.  *     itemOperations={
  14.  *          "get"
  15.  *     },
  16.  *     collectionOperations={
  17.  *           "get",
  18.  *
  19.  *     },
  20.  *     attributes={
  21.  *          "pagination_items_per_page"=10,
  22.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  23.  *     },
  24.  *     order={"rank"}
  25.  * )
  26.  * @ORM\Entity(repositoryClass=ReferenceCandidateStatusRepository::class)
  27.  */
  28. class ReferenceCandidateStatus
  29. {
  30.     use RankTrait;
  31.     public const TRANSLATION_DOMAIN 'reference_candidate';
  32.     public const REFERENCE_CANDIDATE_STATUS_IN_PROGRESS 'reference.candidate.status.IN_PROGRESS';
  33.     public const REFERENCE_CANDIDATE_STATUS_ACCEPTED 'reference.candidate.status.ACCEPTED';
  34.     public const REFERENCE_CANDIDATE_STATUS_REFUSED 'reference.candidate.status.REFUSED';
  35.     public const CODE_IN_PROGRESS '0';
  36.     public const CODE_ACCEPTED '1';
  37.     public const CODE_REFUSED '-1';
  38.     public const ALL_STATUS = [
  39.         self::REFERENCE_CANDIDATE_STATUS_IN_PROGRESS,
  40.         self::REFERENCE_CANDIDATE_STATUS_ACCEPTED,
  41.         self::REFERENCE_CANDIDATE_STATUS_REFUSED
  42.     ];
  43.     public const ALL_CODES = [
  44.         self::CODE_IN_PROGRESS,
  45.         self::CODE_ACCEPTED,
  46.         self::CODE_REFUSED
  47.     ];
  48.     /**
  49.      * @ORM\Id
  50.      * @ORM\GeneratedValue
  51.      * @ORM\Column(type="integer")
  52.      *
  53.      * @Groups({
  54.      *   "candidate:read",
  55.      *   "reference-candidate-status:read",
  56.      *   "recommandation:read"
  57.      * })
  58.      *
  59.      */
  60.     private $id;
  61.     /**
  62.      * @ORM\Column(type="string", length=255)
  63.      * @Groups({
  64.      *   "candidate:read",
  65.      *   "reference-candidate-status:read"
  66.      * })
  67.      */
  68.     private ?string $code;
  69.     /**
  70.      * @ORM\Column(type="string", length=255)
  71.      *
  72.      * @Groups({
  73.      *   "candidate:read",
  74.      *   "reference-candidate-status:read"
  75.      * })
  76.      */
  77.     private ?string $name;
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getCode(): ?string
  83.     {
  84.         return $this->code;
  85.     }
  86.     public function setCode(string $code): self
  87.     {
  88.         $this->code $code;
  89.         return $this;
  90.     }
  91.     public function getName(): ?string
  92.     {
  93.         return $this->name;
  94.     }
  95.     public function setName(string $name): self
  96.     {
  97.         $this->name $name;
  98.         return $this;
  99.     }
  100. }