<?php
namespace App\Entity\Otpusk;
use App\Repository\Otpusk\MarketRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=MarketRepository::class)
*/
class Market
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=256)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Otpusk\Selection", mappedBy="markets")
* @ORM\JoinTable(
* name="SelectionMarket",
* joinColumns={@ORM\JoinColumn(name="market_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="selection_id", referencedColumnName="id")}
* )
*/
private $selections;
/**
* @var Collection|CountryPopular[]
* @ORM\OneToMany(targetEntity="App\Entity\Otpusk\CountryPopular", mappedBy="market")
*/
private $countryPopulars;
/**
* @var Collection|GeoCategoryValues[]
* @ORM\OneToMany(targetEntity="App\Entity\Otpusk\GeoCategoryValues", mappedBy="market", cascade={"persist"}, orphanRemoval=true)
*/
private $marketCategoryValues;
/**
* @var Collection|CountryCharacteristic[]
* @ORM\OneToMany(targetEntity="App\Entity\Otpusk\CountryCharacteristic", mappedBy="market", cascade={"persist"}, orphanRemoval=true)
*/
private $countryCharacteristics;
public function __construct()
{
$this->selections = new ArrayCollection();
$this->countryPopulars = new ArrayCollection();
$this->marketCategoryValues = new ArrayCollection();
$this->countryCharacteristics = new ArrayCollection();
}
public function __toString()
{
return $this->getName();
}
public function setId($id): self
{
$this->id = $id;
return $this;
}
public function getId(): int
{
return $this->id;
}
public function setName($name): self
{
$this->name = $name;
return $this;
}
public function getName(): string
{
return $this->name;
}
/**
* @return Collection|Selection[]
*/
public function getSelections()
{
return $this->selections;
}
/**
* @return Collection|CountryPopular[]
*/
public function getCountryPopulars(): Collection
{
return $this->countryPopulars;
}
public function addCountryPopular(CountryPopular $countryPopular): self
{
if (!$this->countryPopulars->contains($countryPopular)) {
$this->countryPopulars[] = $countryPopular;
$countryPopular->setMarket($this);
}
return $this;
}
public function removeCountryPopular(CountryPopular $countryPopular): self
{
if ($this->countryPopulars->contains($countryPopular)) {
$this->countryPopulars->removeElement($countryPopular);
if ($countryPopular->getMarket() === $this) {
$countryPopular->setMarket(null);
}
}
return $this;
}
/**
* @return Collection|GeoCategoryValues[]
*/
public function getMarketCategoryValues(): Collection
{
return $this->marketCategoryValues;
}
public function addMarketCategoryValue(GeoCategoryValues $value): self
{
if (!$this->marketCategoryValues->contains($value)) {
$this->marketCategoryValues[] = $value;
$value->setMarket($this);
}
return $this;
}
public function removeMarketCategoryValue(GeoCategoryValues $value): self
{
if ($this->marketCategoryValues->contains($value)) {
$this->marketCategoryValues->removeElement($value);
if ($value->getMarket() === $this) {
$value->setMarket(null);
}
}
return $this;
}
public function getCountryCharacteristics(): Collection
{
return $this->countryCharacteristics;
}
public function addCountryCharacteristic(CountryCharacteristic $value): self
{
if (!$this->countryCharacteristics->contains($value)) {
$this->countryCharacteristics[] = $value;
$value->setMarket($this);
}
return $this;
}
public function removeCountryCharacteristic(CountryCharacteristic $value): self
{
if ($this->countryCharacteristics->contains($value)) {
$this->countryCharacteristics->removeElement($value);
if ($value->getMarket() === $this) {
$value->setMarket(null);
}
}
return $this;
}
}