src/Entity/CalculatorPriceYur.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\CalculatorPriceYurRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use ApiPlatform\Metadata\GetCollection;
  7. use ApiPlatform\Metadata\Post;
  8. use ApiPlatform\Metadata\Get;
  9. use ApiPlatform\Metadata\Delete;
  10. use ApiPlatform\Metadata\Put;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. #[ORM\Entity(repositoryClassCalculatorPriceYurRepository::class)]
  13. // #[GetCollection]
  14. // #[Get]
  15. // #[Put(security: "is_granted('ROLE_ADMIN')")]
  16. // #[Post(security: "is_granted('ROLE_ADMIN')")]
  17. // #[Delete(security: "is_granted('ROLE_ADMIN')")]
  18. #[ApiResource(
  19.     normalizationContext: ['groups' => ['read']],
  20.     denormalizationContext: ['groups' => ['write']],
  21.     order: ['id' => 'DESC']
  22. )]
  23. class CalculatorPriceYur
  24. {
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue]
  27.     #[ORM\Column]
  28.     #[Groups(['read''write'])]
  29.     private ?int $id null;
  30.     #[ORM\Column(length10nullabletrue)]
  31.     #[Groups(['read''write'])]
  32.     private ?string $period null;
  33.     #[ORM\ManyToOne(inversedBy'calculatorPriceYurs')]
  34.     #[Groups(['read''write'])]
  35.     private ?OperRozp $oper null;
  36.     #[ORM\Column(nullabletrue)]
  37.     #[Groups(['read''write'])]
  38.     private ?int $klas null;
  39.     #[ORM\Column(nullabletrue)]
  40.     #[Groups(['read''write'])]
  41.     private ?float $priceOne null;
  42.     #[ORM\Column(nullabletrue)]
  43.     #[Groups(['read''write'])]
  44.     private ?float $priceTwo null;
  45.     #[ORM\Column(nullabletrue)]
  46.     #[Groups(['read''write'])]
  47.     private ?float $priceThree null;
  48.     #[ORM\Column(nullabletrue)]
  49.     #[Groups(['read''write'])]
  50.     private ?float $priceFour null;
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getPeriod(): ?string
  56.     {
  57.         return $this->period;
  58.     }
  59.     public function setPeriod(?string $period): self
  60.     {
  61.         $this->period $period;
  62.         return $this;
  63.     }
  64.     public function getOper(): ?OperRozp
  65.     {
  66.         return $this->oper;
  67.     }
  68.     public function setOper(?OperRozp $oper): self
  69.     {
  70.         $this->oper $oper;
  71.         return $this;
  72.     }
  73.     public function getKlas(): ?int
  74.     {
  75.         return $this->klas;
  76.     }
  77.     public function setKlas(?int $klas): self
  78.     {
  79.         $this->klas $klas;
  80.         return $this;
  81.     }
  82.     public function getPriceOne(): ?float
  83.     {
  84.         return $this->priceOne;
  85.     }
  86.     public function setPriceOne(?float $priceOne): self
  87.     {
  88.         $this->priceOne $priceOne;
  89.         return $this;
  90.     }
  91.     public function getPriceTwo(): ?float
  92.     {
  93.         return $this->priceTwo;
  94.     }
  95.     public function setPriceTwo(?float $priceTwo): self
  96.     {
  97.         $this->priceTwo $priceTwo;
  98.         return $this;
  99.     }
  100.     public function getPriceThree(): ?float
  101.     {
  102.         return $this->priceThree;
  103.     }
  104.     public function setPriceThree(?float $priceThree): self
  105.     {
  106.         $this->priceThree $priceThree;
  107.         return $this;
  108.     }
  109.     public function getPriceFour(): ?float
  110.     {
  111.         return $this->priceFour;
  112.     }
  113.     public function setPriceFour(?float $priceFour): self
  114.     {
  115.         $this->priceFour $priceFour;
  116.         return $this;
  117.     }
  118.     /**
  119.      * Magic method to get the value of the field with a digit in the name.
  120.      */
  121.     public function __get(string $name)
  122.     {
  123.         // Remove the 'get' prefix and convert the first character to lowercase.
  124.         $propertyName lcfirst(substr($name3));
  125.         if (property_exists($this$propertyName)) {
  126.             return $this->$propertyName;
  127.         }
  128.         throw new \InvalidArgumentException("Property '{$name}' does not exist.");
  129.     }
  130.     /**
  131.      * Magic method to set the value of the field with a digit in the name.
  132.      */
  133.     public function __set(string $name$value)
  134.     {
  135.         // Remove the 'set' prefix and convert the first character to lowercase.
  136.         $propertyName lcfirst(substr($name3));
  137.         if (property_exists($this$propertyName)) {
  138.             $this->$propertyName $value;
  139.         } else {
  140.             throw new \InvalidArgumentException("Property '{$name}' does not exist.");
  141.         }
  142.     }
  143. }