src/Admin/Modules/OfferGenerator/Entity/OfferGeneratorPriceList.php line 14

  1. <?php
  2. namespace App\Admin\Modules\OfferGenerator\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="offer_generator_price_list")
  9.  * @ORM\Entity
  10.  */
  11. class OfferGeneratorPriceList
  12. {
  13.     const VIEW_TYPE_TABLE 1;
  14.     const VIEW_TYPE_LIST 2;
  15.     /**
  16.      * @ORM\Column(type="integer")
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      */
  20.     private $id;
  21.     
  22.     /**
  23.      * @ORM\Column(name="view_type", type="smallint", nullable=false)
  24.      */
  25.     private $viewType;    
  26.     
  27.     /**
  28.      * @ORM\OneToMany(targetEntity="App\Admin\Modules\OfferGenerator\Entity\OfferGeneratorPriceListGroup", mappedBy="priceList", cascade={"persist"}, orphanRemoval=true)
  29.      * @ORM\OrderBy({"id"="ASC"})
  30.      **/
  31.     private $groups;
  32.     public function __construct()
  33.     {
  34.         $this->groups = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getViewType(): ?int
  41.     {
  42.         return $this->viewType;
  43.     }
  44.     public function setViewType(int $viewType): self
  45.     {
  46.         $this->viewType $viewType;
  47.         return $this;
  48.     }
  49.     /**
  50.      * @return Collection<int, OfferGeneratorPriceListGroup>
  51.      */
  52.     public function getGroups(): Collection
  53.     {
  54.         return $this->groups;
  55.     }
  56.     public function addGroup(OfferGeneratorPriceListGroup $group): self
  57.     {
  58.         if (!$this->groups->contains($group)) {
  59.             $this->groups->add($group);
  60.             $group->setPriceList($this);
  61.         }
  62.         return $this;
  63.     }
  64.     public function removeGroup(OfferGeneratorPriceListGroup $group): self
  65.     {
  66.         if ($this->groups->removeElement($group)) {
  67.             // set the owning side to null (unless already changed)
  68.             if ($group->getPriceList() === $this) {
  69.                 $group->setPriceList(null);
  70.             }
  71.         }
  72.         return $this;
  73.     }
  74. }