src/Entity/Reference/VatReference.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Reference;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. /**
  7.  * @ApiResource(
  8.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  9.  *     normalizationContext={"groups"={"vat_reference:read"}, "swagger_definition_name"="Read"},
  10.  *     denormalizationContext={"groups"={"vat_reference:write"}, "swagger_definition_name"="Write"},
  11.  *     itemOperations={
  12.  *          "get"
  13.  *     },
  14.  *     collectionOperations={
  15.  *           "get",
  16.  *     },
  17.  *     attributes={
  18.  *          "pagination_items_per_page"=10,
  19.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  20.  *     }
  21.  * )
  22.  */
  23. class VatReference
  24. {
  25.     public const TRANSLATION_DOMAIN 'reference_vat';
  26.     public const REFERENCE_VAT_NONE 'reference.vat.NONE';
  27.     public const REFERENCE_VAT_TAXINCLUDED 'reference.vat.TAXINCLUDED';
  28.     public const REFERENCE_VAT_TAXEXCLUDED 'reference.vat.TAXEXCLUDED';
  29.     public const REFERENCE_CODE_VAT_NONE 'NONE';
  30.     public const REFERENCE_CODE_VAT_TAXINCLUDED 'TAXINCLUDED';
  31.     public const REFERENCE_CODE_VAT_TAXEXCLUDED 'TAXEXCLUDED';
  32.     public const VAT_RATE 1.2;
  33.     public const ALL_VAT_NAME = [
  34.         self::REFERENCE_VAT_NONE,
  35.         self::REFERENCE_VAT_TAXINCLUDED,
  36.         self::REFERENCE_VAT_TAXEXCLUDED
  37.     ];
  38.     public const ALL_VAT_CODE = [
  39.         self::REFERENCE_CODE_VAT_NONE,
  40.         self::REFERENCE_CODE_VAT_TAXINCLUDED,
  41.         self::REFERENCE_CODE_VAT_TAXEXCLUDED
  42.     ];
  43.     /**
  44.      * @ApiProperty(identifier=true)
  45.      * @Groups({
  46.      *   "vat_reference:read"
  47.      * })
  48.      */
  49.     private $id;
  50.     /**
  51.      * @Groups({
  52.      *   "mandate:read",
  53.      *   "vat_reference:read"
  54.      * })
  55.      */
  56.     private $name;
  57.     /**
  58.      * @Groups({
  59.      *   "vat_reference:read"
  60.      * })
  61.      */
  62.     private $code;
  63.     public function getId(): ?int
  64.     {
  65.         return $this->id;
  66.     }
  67.     public function setId(string $id): self
  68.     {
  69.         $this->id $id;
  70.         return $this;
  71.     }
  72.     public function getName(): ?string
  73.     {
  74.         return $this->name;
  75.     }
  76.     public function setName(string $name): self
  77.     {
  78.         $this->name $name;
  79.         return $this;
  80.     }
  81.     public function getCode(): ?string
  82.     {
  83.         return $this->code;
  84.     }
  85.     public function setCode(?string $code): self
  86.     {
  87.         $this->code $code;
  88.         return $this;
  89.     }
  90. }