src/Entity/Otpusk/Market.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Otpusk;
  3. use App\Repository\Otpusk\MarketRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=MarketRepository::class)
  9.  */
  10. class Market
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=256)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToMany(targetEntity="App\Entity\Otpusk\Selection", mappedBy="markets")
  24.      * @ORM\JoinTable(
  25.      *     name="SelectionMarket",
  26.      *     joinColumns={@ORM\JoinColumn(name="market_id", referencedColumnName="id")},
  27.      *     inverseJoinColumns={@ORM\JoinColumn(name="selection_id", referencedColumnName="id")}
  28.      * )
  29.      */
  30.     private $selections;
  31.     /**
  32.      * @var Collection|CountryPopular[]
  33.      * @ORM\OneToMany(targetEntity="App\Entity\Otpusk\CountryPopular", mappedBy="market")
  34.      */
  35.     private $countryPopulars;
  36.     /**
  37.      * @var Collection|GeoCategoryValues[]
  38.      * @ORM\OneToMany(targetEntity="App\Entity\Otpusk\GeoCategoryValues", mappedBy="market", cascade={"persist"}, orphanRemoval=true)
  39.      */
  40.     private $marketCategoryValues;
  41.     /**
  42.      * @var Collection|CountryCharacteristic[]
  43.      * @ORM\OneToMany(targetEntity="App\Entity\Otpusk\CountryCharacteristic", mappedBy="market", cascade={"persist"}, orphanRemoval=true)
  44.      */
  45.     private $countryCharacteristics;
  46.     public function __construct()
  47.     {
  48.         $this->selections = new ArrayCollection();
  49.         $this->countryPopulars = new ArrayCollection();
  50.         $this->marketCategoryValues = new ArrayCollection();
  51.         $this->countryCharacteristics = new ArrayCollection();
  52.     }
  53.     public function __toString()
  54.     {
  55.         return $this->getName();
  56.     }
  57.     public function setId($id): self
  58.     {
  59.         $this->id $id;
  60.         return $this;
  61.     }
  62.     public function getId(): int
  63.     {
  64.         return $this->id;
  65.     }
  66.     public function setName($name): self
  67.     {
  68.         $this->name $name;
  69.         return $this;
  70.     }
  71.     public function getName(): string
  72.     {
  73.         return $this->name;
  74.     }
  75.     /**
  76.      * @return Collection|Selection[]
  77.      */
  78.     public function getSelections()
  79.     {
  80.         return $this->selections;
  81.     }
  82.     /**
  83.      * @return Collection|CountryPopular[]
  84.      */
  85.     public function getCountryPopulars(): Collection
  86.     {
  87.         return $this->countryPopulars;
  88.     }
  89.     public function addCountryPopular(CountryPopular $countryPopular): self
  90.     {
  91.         if (!$this->countryPopulars->contains($countryPopular)) {
  92.             $this->countryPopulars[] = $countryPopular;
  93.             $countryPopular->setMarket($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeCountryPopular(CountryPopular $countryPopular): self
  98.     {
  99.         if ($this->countryPopulars->contains($countryPopular)) {
  100.             $this->countryPopulars->removeElement($countryPopular);
  101.             if ($countryPopular->getMarket() === $this) {
  102.                 $countryPopular->setMarket(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection|GeoCategoryValues[]
  109.      */
  110.     public function getMarketCategoryValues(): Collection
  111.     {
  112.         return $this->marketCategoryValues;
  113.     }
  114.     public function addMarketCategoryValue(GeoCategoryValues $value): self
  115.     {
  116.         if (!$this->marketCategoryValues->contains($value)) {
  117.             $this->marketCategoryValues[] = $value;
  118.             $value->setMarket($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeMarketCategoryValue(GeoCategoryValues $value): self
  123.     {
  124.         if ($this->marketCategoryValues->contains($value)) {
  125.             $this->marketCategoryValues->removeElement($value);
  126.             if ($value->getMarket() === $this) {
  127.                 $value->setMarket(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132.     public function getCountryCharacteristics(): Collection
  133.     {
  134.         return $this->countryCharacteristics;
  135.     }
  136.     public function addCountryCharacteristic(CountryCharacteristic $value): self
  137.     {
  138.         if (!$this->countryCharacteristics->contains($value)) {
  139.             $this->countryCharacteristics[] = $value;
  140.             $value->setMarket($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeCountryCharacteristic(CountryCharacteristic $value): self
  145.     {
  146.         if ($this->countryCharacteristics->contains($value)) {
  147.             $this->countryCharacteristics->removeElement($value);
  148.             if ($value->getMarket() === $this) {
  149.                 $value->setMarket(null);
  150.             }
  151.         }
  152.         return $this;
  153.     }
  154. }