src/Entity/Fees.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\FeesRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassFeesRepository::class)]
  10. #[ApiResource(
  11.     normalizationContext: ['groups' => ['fees:read']],
  12.     denormalizationContext: ['groups' => ['fees:write']],
  13.     order: ['id' => 'DESC'],
  14. )]
  15. class Fees
  16. {
  17.     #[Groups(['fees:read''fees:write''pre_order:read'])]
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[Groups(['fees:read''fees:write''pre_order:read'])]
  23.     #[ORM\Column(length255)]
  24.     private ?string $name null;
  25.     #[Groups(['fees:read''fees:write''pre_order:read'])]
  26.     #[ORM\Column(nullabletrue)]
  27.     private ?float $sum null;
  28.     #[Groups(['fees:read''fees:write''pre_order:read'])]
  29.     #[ORM\Column(nullabletrue)]
  30.     private ?float $percent null;
  31.     #[Groups(['fees:read''fees:write''pre_order:read'])]
  32.     #[ORM\Column(length100nullabletrue)]
  33.     private ?string $status null;
  34.     #[Groups(['fees:read''fees:write''pre_order:read'])]
  35.     #[ORM\Column(length100nullabletrue)]
  36.     private ?string $type null;
  37.     #[Groups(['fees:read''fees:write'])]
  38.     #[ORM\ManyToMany(targetEntityPreOrder::class, inversedBy'fees')]
  39.     private Collection $pre_orders;
  40.     public function __construct()
  41.     {
  42.         $this->pre_orders = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getName(): ?string
  49.     {
  50.         return $this->name;
  51.     }
  52.     public function setName(string $name): self
  53.     {
  54.         $this->name $name;
  55.         return $this;
  56.     }
  57.     public function getSum(): ?float
  58.     {
  59.         return $this->sum;
  60.     }
  61.     public function setSum(?float $sum): self
  62.     {
  63.         $this->sum $sum;
  64.         return $this;
  65.     }
  66.     public function getPercent(): ?float
  67.     {
  68.         return $this->percent;
  69.     }
  70.     public function setPercent(?float $percent): self
  71.     {
  72.         $this->percent $percent;
  73.         return $this;
  74.     }
  75.     public function getStatus(): ?string
  76.     {
  77.         return $this->status;
  78.     }
  79.     public function setStatus(?string $status): self
  80.     {
  81.         $this->status $status;
  82.         return $this;
  83.     }
  84.     public function getType(): ?string
  85.     {
  86.         return $this->type;
  87.     }
  88.     public function setType(?string $type): self
  89.     {
  90.         $this->type $type;
  91.         return $this;
  92.     }
  93.     
  94.         /**
  95.      * @return Collection<int, PreOrder>
  96.      */
  97.     public function getPreOrders(): Collection
  98.     {
  99.         return $this->pre_orders;
  100.     }
  101.     public function addPreOrder(PreOrder $preOrder): self
  102.     {
  103.         if (!$this->pre_orders->contains($preOrder)) {
  104.             $this->pre_orders->add($preOrder);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removePreOrder(PreOrder $preOrder): self
  109.     {
  110.         $this->pre_orders->removeElement($preOrder);
  111.         return $this;
  112.     }
  113. }