src/Entity/Pack.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PackRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PackRepository::class)
  9.  */
  10. class Pack
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $label;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $price;
  26.     /**
  27.      * @ORM\Column(type="datetime")
  28.      */
  29.     private $creation_date;
  30.     /**
  31.      * @ORM\ManyToMany(targetEntity="Product")
  32.      * @ORM\JoinTable(name="pack_products",
  33.      *      joinColumns={@ORM\JoinColumn(name="pack_id", referencedColumnName="id")},
  34.      *      inverseJoinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")}
  35.      *      )
  36.      */
  37.     private $products;
  38.     /**
  39.      * @ORM\Column(type="integer")
  40.      */
  41.     private $quantity;
  42.     /**
  43.      * @ORM\Column(type="string", length=100, nullable=true)
  44.      */
  45.     private $barcode;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=SalePacks::class, mappedBy="pack")
  48.      */
  49.     private $salePacks;
  50.     /**
  51.      * @ORM\Column(type="string", length=255)
  52.      */
  53.     private $target;
  54.     /**
  55.      * @ORM\Column(type="boolean")
  56.      */
  57.     private $isSynch;
  58.     /**
  59.      * @ORM\Column(type="boolean")
  60.      */
  61.     private $deleted 0;
  62.     public function __construct()
  63.     {
  64.         $this->products = new ArrayCollection();
  65.     }
  66.     public function getId(): ?int
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getLabel(): ?string
  71.     {
  72.         return $this->label;
  73.     }
  74.     public function setLabel(string $label): self
  75.     {
  76.         $this->label $label;
  77.         return $this;
  78.     }
  79.     public function getPrice(): ?int
  80.     {
  81.         return $this->price;
  82.     }
  83.     public function setPrice(int $price): self
  84.     {
  85.         $this->price $price;
  86.         return $this;
  87.     }
  88.     public function getCreationDate(): ?\DateTimeInterface
  89.     {
  90.         return $this->creation_date;
  91.     }
  92.     public function setCreationDate(\DateTimeInterface $creation_date): self
  93.     {
  94.         $this->creation_date $creation_date;
  95.         return $this;
  96.     }
  97.     /**
  98.      * @return Collection<int, PackProducts>
  99.      */
  100.     public function getProducts(): Collection
  101.     {
  102.         return $this->products;
  103.     }
  104.     public function addProduct(PackProducts $product): self
  105.     {
  106.         if (!$this->products->contains($product)) {
  107.             $this->products[] = $product;
  108.             $product->setPack($this);
  109.         }
  110.         return $this;
  111.     }
  112.     public function removeProduct(PackProducts $product): self
  113.     {
  114.         if ($this->products->removeElement($product)) {
  115.             // set the owning side to null (unless already changed)
  116.             if ($product->getPack() === $this) {
  117.                 $product->setPack(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122.     public function getQuantity(): ?int
  123.     {
  124.         return $this->quantity;
  125.     }
  126.     public function setQuantity(int $quantity): self
  127.     {
  128.         $this->quantity $quantity;
  129.         return $this;
  130.     }
  131.     public function getBarcode(): ?string
  132.     {
  133.         return $this->barcode;
  134.     }
  135.     public function setBarcode(?string $barcode): self
  136.     {
  137.         $this->barcode $barcode;
  138.         return $this;
  139.     }
  140.     /**
  141.      * @return Collection<int, SalePacks>
  142.      */
  143.     public function getSalePacks(): Collection
  144.     {
  145.         return $this->salePacks;
  146.     }
  147.     public function addSalePacks(SalePacks $saleItem): self
  148.     {
  149.         if (!$this->salePacks->contains($saleItem)) {
  150.             $this->salePacks[] = $saleItem;
  151.             $saleItem->setPack($this);
  152.         }
  153.         return $this;
  154.     }
  155.     public function removeSalePacks(SalePacks $saleItem): self
  156.     {
  157.         if ($this->salePacks->removeElement($saleItem)) {
  158.             // set the owning side to null (unless already changed)
  159.             if ($saleItem->getProduct() === $this) {
  160.                 $saleItem->setProduct(null);
  161.             }
  162.         }
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return mixed
  167.      */
  168.     public function getTarget()
  169.     {
  170.         return $this->target;
  171.     }
  172.     /**
  173.      * @param mixed $target
  174.      */
  175.     public function setTarget($target): void
  176.     {
  177.         $this->target $target;
  178.     }
  179.     /**
  180.      * @return mixed
  181.      */
  182.     public function getisSynch()
  183.     {
  184.         return $this->isSynch;
  185.     }
  186.     /**
  187.      * @param mixed $isSynch
  188.      */
  189.     public function setisSynch($isSynch): void
  190.     {
  191.         $this->isSynch $isSynch;
  192.     }
  193.     /**
  194.      * @return mixed
  195.      */
  196.     public function getDeleted()
  197.     {
  198.         return $this->deleted;
  199.     }
  200.     /**
  201.      * @param mixed $deleted
  202.      */
  203.     public function setDeleted($deleted): void
  204.     {
  205.         $this->deleted $deleted;
  206.     }
  207. }