src/Entity/Prices.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\PricesRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use ApiPlatform\Metadata\ApiFilter;
  9. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  10. #[ORM\Entity(repositoryClassPricesRepository::class)]
  11. #[ApiResource(
  12.     normalizationContext: ['groups' => ['price:read']],
  13.     denormalizationContext: ['groups' => ['price:write']],
  14.     order: ['id' => 'DESC'],
  15. )]
  16. #[ApiFilter(
  17.     SearchFilter::class, 
  18.     properties: [
  19.         'product' => 'exact',
  20.         'agreement.id' => 'exact',
  21.         'agreement.virtual' => 'exact',
  22.         'agreement.account.id' => 'exact',
  23.     ],
  24. )]
  25. class Prices 
  26. {
  27.     #[ORM\Id]
  28.     #[ORM\GeneratedValue]
  29.     #[ORM\Column]
  30.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  31.     private ?int $id null;
  32.     #[ORM\ManyToOne(inversedBy'prices')]
  33.     #[Groups(['price:read''price:write'])]
  34.     private ?Products $product null;
  35.     #[ORM\ManyToOne(inversedBy'prices')]
  36.     #[Groups(['price:read''price:write'])]
  37.     private ?Agreements $agreement null;
  38.     #[ORM\Column(nullabletrue)]
  39.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  40.     private ?float $price null;
  41.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  42.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  43.     private ?string $description null;
  44.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  45.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  46.     private ?\DateTimeInterface $date_entered null;
  47.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  48.     #[ORM\Column(nullabletrue)]
  49.     private ?bool $active null;
  50.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  51.     #[ORM\Column(nullabletrue)]
  52.     private ?float $sellPrice null;
  53.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  54.     #[ORM\Column(nullabletrue)]
  55.     private ?float $markUp null;
  56.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  57.     #[ORM\Column(nullabletrue)]
  58.     private ?float $priceSalesFact null;
  59.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  60.     #[ORM\Column(nullabletrue)]
  61.     private ?float $purchasePrice null;
  62.     #[Groups(['price:read''price:write''agreements:read''product:read''order:read''load_invoice:read''pre_order:write'])]
  63.     #[ORM\Column(length100nullabletrue)]
  64.     private ?string $code1c null;
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getProduct(): ?Products
  70.     {
  71.         return $this->product;
  72.     }
  73.     public function setProduct(?Products $product): static
  74.     {
  75.         $this->product $product;
  76.         return $this;
  77.     }
  78.     public function getAgreement(): ?Agreements
  79.     {
  80.         return $this->agreement;
  81.     }
  82.     public function setAgreement(?Agreements $agreement): static
  83.     {
  84.         $this->agreement $agreement;
  85.         return $this;
  86.     }
  87.     public function getPrice(): ?float
  88.     {
  89.         return $this->price;
  90.     }
  91.     public function setPrice(?float $price): static
  92.     {
  93.         $this->price $price;
  94.         return $this;
  95.     }
  96.     public function getDescription(): ?string
  97.     {
  98.         return $this->description;
  99.     }
  100.     public function setDescription(?string $description): static
  101.     {
  102.         $this->description $description;
  103.         return $this;
  104.     }
  105.     public function getDateEntered(): ?\DateTimeInterface
  106.     {
  107.         return $this->date_entered;
  108.     }
  109.     public function setDateEntered(?\DateTimeInterface $date_entered): static
  110.     {
  111.         $this->date_entered $date_entered;
  112.         return $this;
  113.     }
  114.     public function isActive(): ?bool
  115.     {
  116.         return $this->active;
  117.     }
  118.     public function setActive(?bool $active): static
  119.     {
  120.         $this->active $active;
  121.         return $this;
  122.     }
  123.     public function getSellPrice(): ?float
  124.     {
  125.         return $this->sellPrice;
  126.     }
  127.     public function setSellPrice(?float $sellPrice): static
  128.     {
  129.         $this->sellPrice $sellPrice;
  130.         return $this;
  131.     }
  132.     public function getMarkUp(): ?float
  133.     {
  134.         return $this->markUp;
  135.     }
  136.     public function setMarkUp(?float $markUp): static
  137.     {
  138.         $this->markUp $markUp;
  139.         return $this;
  140.     }
  141.     public function getPriceSalesFact(): ?float
  142.     {
  143.         return $this->priceSalesFact;
  144.     }
  145.     public function setPriceSalesFact(?float $priceSalesFact): static
  146.     {
  147.         $this->priceSalesFact $priceSalesFact;
  148.         return $this;
  149.     }
  150.     public function getPurchasePrice(): ?float
  151.     {
  152.         return $this->purchasePrice;
  153.     }
  154.     public function setPurchasePrice(?float $purchasePrice): static
  155.     {
  156.         $this->purchasePrice $purchasePrice;
  157.         return $this;
  158.     }
  159.     public function getCode1c(): ?string
  160.     {
  161.         return $this->code1c;
  162.     }
  163.     public function setCode1c(?string $code1c): static
  164.     {
  165.         $this->code1c $code1c;
  166.         return $this;
  167.     }
  168. }