src/Admin/Modules/OnlineService/Entity/OnlineServiceCreatorPriceListGroup.php line 13

  1. <?php
  2. namespace App\Admin\Modules\OnlineService\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Table(name="online_service_creator_price_list_group")
  8.  * @ORM\Entity
  9.  */
  10. class OnlineServiceCreatorPriceListGroup
  11. {
  12.     /**
  13.      * @ORM\Column(type="integer")
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue(strategy="AUTO")
  16.      */
  17.     private $id;
  18.     
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity="App\Admin\Modules\OnlineService\Entity\OnlineServiceCreatorPriceList", inversedBy="groups")
  21.      * @ORM\JoinColumns({
  22.      *   @ORM\JoinColumn(name="id_online_service_creator_price_list", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  23.      * })
  24.      */
  25.     private $priceList;
  26.     /**
  27.      * @ORM\Column(name="name", type="string", length=255, nullable=false)
  28.      */
  29.     private $name;   
  30.     
  31.     /**
  32.      * @ORM\OneToMany(targetEntity="App\Admin\Modules\OnlineService\Entity\OnlineServiceCreatorPriceListGroupItem", mappedBy="group", cascade={"persist"}, orphanRemoval=true)
  33.      * @ORM\OrderBy({"id"="ASC"})
  34.      **/
  35.     private $items;
  36.     public function __construct()
  37.     {
  38.         $this->items = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getPriceList(): ?OnlineServiceCreatorPriceList
  54.     {
  55.         return $this->priceList;
  56.     }
  57.     public function setPriceList(?OnlineServiceCreatorPriceList $priceList): self
  58.     {
  59.         $this->priceList $priceList;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection<int, OnlineServiceCreatorPriceListGroupItem>
  64.      */
  65.     public function getItems(): Collection
  66.     {
  67.         return $this->items;
  68.     }
  69.     public function addItem(OnlineServiceCreatorPriceListGroupItem $item): self
  70.     {
  71.         if (!$this->items->contains($item)) {
  72.             $this->items->add($item);
  73.             $item->setGroup($this);
  74.         }
  75.         return $this;
  76.     }
  77.     public function removeItem(OnlineServiceCreatorPriceListGroupItem $item): self
  78.     {
  79.         if ($this->items->removeElement($item)) {
  80.             // set the owning side to null (unless already changed)
  81.             if ($item->getGroup() === $this) {
  82.                 $item->setGroup(null);
  83.             }
  84.         }
  85.         return $this;
  86.     }
  87. }