src/Entity/ItemVariationSection.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ItemVariationSectionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassItemVariationSectionRepository::class)]
  8. class ItemVariationSection
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityItemVariation::class, inversedBy'itemVariationSections')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private $variation;
  17.     #[ORM\OneToMany(mappedBy'itemVariationSection'targetEntityItemStock::class, orphanRemovaltrue)]
  18.     private $stocks;
  19.     #[ORM\ManyToOne(targetEntitySection::class, inversedBy'itemVariationSections')]
  20.     private $section;
  21.     public function __construct()
  22.     {
  23.         $this->stocks = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getVariation(): ?ItemVariation
  30.     {
  31.         return $this->variation;
  32.     }
  33.     public function setVariation(?ItemVariation $variation): self
  34.     {
  35.         $this->variation $variation;
  36.         return $this;
  37.     }
  38.     /**
  39.      * @return Collection<int, ItemStock>
  40.      */
  41.     public function getStocks(): Collection
  42.     {
  43.         return $this->stocks;
  44.     }
  45.     public function addStock(ItemStock $stock): self
  46.     {
  47.         if (!$this->stocks->contains($stock)) {
  48.             $this->stocks[] = $stock;
  49.             $stock->setItemVariationSection($this);
  50.         }
  51.         return $this;
  52.     }
  53.     public function removeStock(ItemStock $stock): self
  54.     {
  55.         if ($this->stocks->removeElement($stock)) {
  56.             // set the owning side to null (unless already changed)
  57.             if ($stock->getItemVariationSection() === $this) {
  58.                 $stock->setItemVariationSection(null);
  59.             }
  60.         }
  61.         return $this;
  62.     }
  63.     public function getSection(): ?Section
  64.     {
  65.         return $this->section;
  66.     }
  67.     public function setSection(?Section $section): self
  68.     {
  69.         $this->section $section;
  70.         return $this;
  71.     }
  72. }