src/Entity/ProductsSizes.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductsSizesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductsSizesRepository::class)]
  8. class ProductsSizes
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(inversedBy'productsSizes')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private ?Product $product null;
  17.     #[ORM\ManyToOne(inversedBy'productsSizes')]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Sizes $size null;
  20.     #[ORM\Column]
  21.     private ?int $count null;
  22.     #[ORM\OneToMany(mappedBy'size'targetEntityShopCart::class)]
  23.     private Collection $shopCartItem;
  24.     #[ORM\OneToMany(mappedBy'productsSizes'targetEntityOrderProductsSizes::class, orphanRemovaltrue)]
  25.     private Collection $orderProductsSizes;
  26.     public function __construct()
  27.     {
  28.         $this->shopCartItem = new ArrayCollection();
  29.         $this->orderProductsSizes = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getProduct(): ?Product
  36.     {
  37.         return $this->product;
  38.     }
  39.     public function setProduct(?Product $product): self
  40.     {
  41.         $this->product $product;
  42.         return $this;
  43.     }
  44.     public function getSize(): ?Sizes
  45.     {
  46.         return $this->size;
  47.     }
  48.     public function setSize(?Sizes $size): self
  49.     {
  50.         $this->size $size;
  51.         return $this;
  52.     }
  53.     public function getCount(): ?int
  54.     {
  55.         return $this->count;
  56.     }
  57.     public function setCount(int $count): self
  58.     {
  59.         $this->count $count;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection<int, ShopCart>
  64.      */
  65.     public function getShopCartItem(): Collection
  66.     {
  67.         return $this->shopCartItem;
  68.     }
  69.     /**
  70.      * @param ShopCart $shopCartItem
  71.      * @return $this
  72.      */
  73.     public function addShopCartItem(ShopCart $shopCartItem): self
  74.     {
  75.         if (!$this->shopCartItem->contains($shopCartItem)) {
  76.             $this->shopCartItem->add($shopCartItem);
  77.             $shopCartItem->setSize($this);
  78.         }
  79.         return $this;
  80.     }
  81.     /**
  82.      * @param ShopCart $shopCartItem
  83.      * @return $this
  84.      */
  85.     public function removeShopCartItem(ShopCart $shopCartItem): self
  86.     {
  87.         if ($this->shopCartItem->removeElement($shopCartItem)) {
  88.             // set the owning side to null (unless already changed)
  89.             if ($shopCartItem->getSize() === $this) {
  90.                 $shopCartItem->setSize(null);
  91.             }
  92.         }
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, OrderProductsSizes>
  97.      */
  98.     public function getOrderProductsSizes(): Collection
  99.     {
  100.         return $this->orderProductsSizes;
  101.     }
  102.     /**
  103.      * @param OrderProductsSizes $orderProductsSize
  104.      * @return $this
  105.      */
  106.     public function addOrderProductsSize(OrderProductsSizes $orderProductsSize): static
  107.     {
  108.         if (!$this->orderProductsSizes->contains($orderProductsSize)) {
  109.             $this->orderProductsSizes->add($orderProductsSize);
  110.             $orderProductsSize->setProductsSizes($this);
  111.         }
  112.         return $this;
  113.     }
  114.     /**
  115.      * @param OrderProductsSizes $orderProductsSize
  116.      * @return $this
  117.      */
  118.     public function removeOrderProductsSize(OrderProductsSizes $orderProductsSize): static
  119.     {
  120.         if ($this->orderProductsSizes->removeElement($orderProductsSize)) {
  121.             // set the owning side to null (unless already changed)
  122.             if ($orderProductsSize->getProductsSizes() === $this) {
  123.                 $orderProductsSize->setProductsSizes(null);
  124.             }
  125.         }
  126.         return $this;
  127.     }
  128. }