src/Entity/Vat.php line 29

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\VatRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ApiResource(
  9.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  10.  *     normalizationContext={"groups"={"vat:read"}, "swagger_definition_name"="Read"},
  11.  *     denormalizationContext={"groups"={"vat:write"}, "swagger_definition_name"="Write"},
  12.  *     itemOperations={
  13.  *          "get"
  14.  *     },
  15.  *     collectionOperations={
  16.  *           "get",
  17.  *
  18.  *     },
  19.  *     attributes={
  20.  *          "pagination_items_per_page"=10,
  21.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  22.  *     }
  23.  * )
  24.  * @ORM\Entity(repositoryClass=VatRepository::class)
  25.  */
  26. class Vat
  27. {
  28.     public const DEFAULT_VAT 0.2;
  29.     public const NONE_VAT 0;
  30.     public const ALL_VAT = [self::DEFAULT_VAT,self::NONE_VAT];
  31.     /**
  32.      * @ORM\Id
  33.      * @ORM\GeneratedValue
  34.      * @ORM\Column(type="integer")
  35.      * @Groups({"vat:read","transaction:read", "transaction-item:read", "business-indication:item:read"})
  36.      */
  37.     private $id;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      * @Groups({"vat:read","transaction:read", "transaction-item:read", "business-indication:item:read"})
  41.      */
  42.     private $tax;
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getTax(): ?string
  48.     {
  49.         return $this->tax;
  50.     }
  51.     public function setTax(string $tax): self
  52.     {
  53.         $this->tax $tax;
  54.         return $this;
  55.     }
  56. }