src/Shop/Doctrine/Entity/Price.php line 22

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Shop\Doctrine\Entity;
  4. use App\Shop\Doctrine\Repository\PriceRepository;
  5. use DateTimeImmutable;
  6. use Doctrine\ORM\Mapping\Column;
  7. use Doctrine\ORM\Mapping\Entity;
  8. use Doctrine\ORM\Mapping\GeneratedValue;
  9. use Doctrine\ORM\Mapping\Id;
  10. use Doctrine\ORM\Mapping\JoinColumn;
  11. use Doctrine\ORM\Mapping\ManyToOne;
  12. use Doctrine\ORM\Mapping\Table;
  13. use Symfony\Component\PropertyAccess\PropertyAccess;
  14. use Symfony\Component\Serializer\Annotation\Groups;
  15. use Symfony\Component\Validator\Constraints\NotBlank;
  16. #[Entity(repositoryClassPriceRepository::class)]
  17. #[Table(name'`shop_price`')]
  18. class Price
  19. {
  20.     #[Id]
  21.     #[Column(type'integer')]
  22.     #[GeneratedValue]
  23.     #[Groups(['product'])]
  24.     private ?int $id null;
  25.     #[Column(type'datetime_immutable')]
  26.     private DateTimeImmutable $createdAt;
  27.     #[ManyToOne(targetEntityProduct::class, inversedBy'pricingHistory')]
  28.     #[JoinColumn(nullablefalseonDelete'CASCADE')]
  29.     private Product $product;
  30.     #[ManyToOne(targetEntityVat::class)]
  31.     #[JoinColumn(nullablefalse)]
  32.     private Vat $vat;
  33.     #[Column(type'integer')]
  34.     #[NotBlank]
  35.     private int $purchasePrice;
  36.     #[Column(type'integer')]
  37.     #[NotBlank]
  38.     private int $retailPrice;
  39.     #[Column(type'integer'options: ['default' => 0])]
  40.     #[NotBlank]
  41.     private int $shippingCosts;
  42.     #[Column(type'integer')]
  43.     #[NotBlank]
  44.     private int $ecoTax;
  45.     #[Column(type'integer')]
  46.     #[NotBlank]
  47.     private int $extraCost 0;
  48.     #[Column(type'integer'nullabletrueoptions: ['default' => null])]
  49.     private ?int $ppgc null;
  50.     public function __construct()
  51.     {
  52.         $this->createdAt = new DateTimeImmutable();
  53.     }
  54.     public function __get(string $name): mixed
  55.     {
  56.         $propertyAccessor PropertyAccess::createPropertyAccessor();
  57.         return $propertyAccessor->getValue($this$name);
  58.     }
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function getCreatedAt(): DateTimeImmutable
  64.     {
  65.         return $this->createdAt;
  66.     }
  67.     public function getProduct(): Product
  68.     {
  69.         return $this->product;
  70.     }
  71.     public function setProduct(Product $product): void
  72.     {
  73.         $this->product $product;
  74.     }
  75.     public function getPurchasePrice(): int
  76.     {
  77.         return $this->purchasePrice;
  78.     }
  79.     public function setPurchasePrice(int $purchasePrice): void
  80.     {
  81.         $this->purchasePrice $purchasePrice;
  82.     }
  83.     public function getVat(): Vat
  84.     {
  85.         return $this->vat;
  86.     }
  87.     public function setVat(Vat $vat): void
  88.     {
  89.         $this->vat $vat;
  90.     }
  91.     public function getRetailPrice(): int
  92.     {
  93.         return $this->retailPrice;
  94.     }
  95.     public function setRetailPrice(int $retailPrice): void
  96.     {
  97.         $this->retailPrice $retailPrice;
  98.     }
  99.     public function getShippingCosts(): int
  100.     {
  101.         return $this->shippingCosts;
  102.     }
  103.     public function setShippingCosts(int $shippingCosts): void
  104.     {
  105.         $this->shippingCosts $shippingCosts;
  106.     }
  107.     public function getEcoTax(): int
  108.     {
  109.         return $this->ecoTax;
  110.     }
  111.     public function setEcoTax(int $ecoTax): void
  112.     {
  113.         $this->ecoTax $ecoTax;
  114.     }
  115.     public function getExtraCost(): int
  116.     {
  117.         return $this->extraCost;
  118.     }
  119.     public function setExtraCost(int $extraCost): void
  120.     {
  121.         $this->extraCost $extraCost;
  122.     }
  123.     public function getPpgc(): ?int
  124.     {
  125.         return $this->ppgc;
  126.     }
  127.     public function setPpgc(int $ppgc): void
  128.     {
  129.         $this->ppgc $ppgc;
  130.     }
  131. }