src/Entity/Product.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductRepository::class)]
  8. class Product
  9. {
  10.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  11.     private int $id;
  12.     #[ORM\Column(type'string'length255)]
  13.     private string $name;
  14.     #[ORM\Column(type'float')]
  15.     private float $damagedPrice;
  16.     #[ORM\Column(type'float')]
  17.     private float $normalPrice;
  18.     #[ORM\Column(type'float')]
  19.     private float $excellentPrice;
  20.     #[ORM\Column(type'boolean')]
  21.     private bool $accepted;
  22.     #[ORM\Column(type'float'nullabletrue)]
  23.     private ?float $weight;
  24.     #[ORM\Column(type'integer'nullabletrue)]
  25.     private ?int $pspId;
  26.     #[ORM\ManyToOne(targetEntityProductCategorie::class, inversedBy'product')]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private $productCategorie;
  29.     #[ORM\OneToMany(targetEntityProductTag::class, mappedBy'product'orphanRemovaltrue)]
  30.     private Collection $productTags;
  31.     #[ORM\ManyToOne(targetEntityProductBrand::class, inversedBy'product')]
  32.     #[ORM\JoinColumn(nullablefalse)]
  33.     private $productBrand;
  34.     #[ORM\OneToMany(targetEntityProductTradeIn::class, mappedBy'product'orphanRemovaltrue)]
  35.     private Collection $productTradeIns;
  36.     #[ORM\Column(type'boolean')]
  37.     private bool $is_active;
  38.     public function __construct()
  39.     {
  40.         $this->productTags = new ArrayCollection();
  41.         $this->productTradeIns = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getName(): ?string
  48.     {
  49.         if(isset($this->name)) {
  50.             return $this->name;
  51.         }
  52.         return "";
  53.     }
  54.     public function setName(string $name): self
  55.     {
  56.         $this->name $name;
  57.         return $this;
  58.     }
  59.     public function getDamagedPrice(): ?float
  60.     {
  61.         return $this->damagedPrice;
  62.     }
  63.     public function setDamagedPrice(float $damagedPrice): self
  64.     {
  65.         $this->damagedPrice $damagedPrice;
  66.         return $this;
  67.     }
  68.     public function getNormalPrice(): ?float
  69.     {
  70.         return $this->normalPrice;
  71.     }
  72.     public function setNormalPrice(float $normalPrice): self
  73.     {
  74.         $this->normalPrice $normalPrice;
  75.         return $this;
  76.     }
  77.     public function getExcellentPrice(): ?float
  78.     {
  79.         return $this->excellentPrice;
  80.     }
  81.     public function setExcellentPrice(float $excellentPrice): self
  82.     {
  83.         $this->excellentPrice $excellentPrice;
  84.         return $this;
  85.     }
  86.     public function getAccepted(): ?bool
  87.     {
  88.         return $this->accepted;
  89.     }
  90.     public function setAccepted(bool $accepted): self
  91.     {
  92.         $this->accepted $accepted;
  93.         return $this;
  94.     }
  95.     public function getWeight(): ?float
  96.     {
  97.         return $this->weight;
  98.     }
  99.     public function setWeight(?float $weight): self
  100.     {
  101.         $this->weight $weight;
  102.         return $this;
  103.     }
  104.     public function getPspId(): ?int
  105.     {
  106.         return $this->pspId;
  107.     }
  108.     public function setPspId(?int $pspId): self
  109.     {
  110.         $this->pspId $pspId;
  111.         return $this;
  112.     }
  113.     public function getProductCategorie(): ?ProductCategorie
  114.     {
  115.         return $this->productCategorie;
  116.     }
  117.     public function setProductCategorie(?ProductCategorie $productCategorie): self
  118.     {
  119.         $this->productCategorie $productCategorie;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return Collection|ProductTag[]
  124.      */
  125.     public function getProductTags(): Collection
  126.     {
  127.         return $this->productTags;
  128.     }
  129.     public function addProductTag(ProductTag $productTag): self
  130.     {
  131.         if (!$this->productTags->contains($productTag)) {
  132.             $this->productTags[] = $productTag;
  133.             $productTag->setProduct($this);
  134.         }
  135.         return $this;
  136.     }
  137.     public function removeProductTag(ProductTag $productTag): self
  138.     {
  139.         if ($this->productTags->removeElement($productTag)) {
  140.             // set the owning side to null (unless already changed)
  141.             if ($productTag->getProduct() === $this) {
  142.                 $productTag->setProduct(null);
  143.             }
  144.         }
  145.         return $this;
  146.     }
  147.     public function getProductBrand(): ?ProductBrand
  148.     {
  149.         return $this->productBrand;
  150.     }
  151.     public function setProductBrand(?ProductBrand $productBrand): self
  152.     {
  153.         $this->productBrand $productBrand;
  154.         return $this;
  155.     }
  156.     /**
  157.      * @return Collection|ProductTradeIn[]
  158.      */
  159.     public function getProductTradeIns(): Collection
  160.     {
  161.         return $this->productTradeIns;
  162.     }
  163.     public function addProductTradeIn(ProductTradeIn $productTradeIn): self
  164.     {
  165.         if (!$this->productTradeIns->contains($productTradeIn)) {
  166.             $this->productTradeIns[] = $productTradeIn;
  167.             $productTradeIn->setProduct($this);
  168.         }
  169.         return $this;
  170.     }
  171.     public function removeProductTradeIn(ProductTradeIn $productTradeIn): self
  172.     {
  173.         if ($this->productTradeIns->removeElement($productTradeIn)) {
  174.             // set the owning side to null (unless already changed)
  175.             if ($productTradeIn->getProduct() === $this) {
  176.                 $productTradeIn->setProduct(null);
  177.             }
  178.         }
  179.         return $this;
  180.     }
  181.     public function getIsActive(): ?bool
  182.     {
  183.         return $this->is_active;
  184.     }
  185.     public function setIsActive(bool $is_active): self
  186.     {
  187.         $this->is_active $is_active;
  188.         return $this;
  189.     }
  190. }