* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShopBundle\Entity; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** * Shop. * * @ORM\Table() * @ORM\Entity(repositoryClass="PrestaShopBundle\Entity\Repository\ShopRepository") */ class Shop { /** * @var int * * @ORM\Id * @ORM\Column(name="id_shop", type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @ORM\ManyToOne(targetEntity="PrestaShopBundle\Entity\ShopGroup", inversedBy="shops") * @ORM\JoinColumn(name="id_shop_group", referencedColumnName="id_shop_group", nullable=false) */ private $shopGroup; /** * @var string * * @ORM\Column(name="name", type="string", length=64) */ private $name; /** * @var string * * @ORM\Column(name="color", type="string", length=50) */ private $color; /** * @var int * * @ORM\Column(name="id_category", type="integer") */ private $idCategory; /** * @var string * * @ORM\Column(name="theme_name", type="string", length=255) */ private $themeName; /** * @var bool * * @ORM\Column(name="active", type="boolean") */ private $active; /** * @var bool * * @ORM\Column(name="deleted", type="boolean") */ private $deleted; /** * @var Collection * * One group shop has many shops. This is the inverse side. * @ORM\OneToMany(targetEntity="PrestaShopBundle\Entity\ShopUrl", mappedBy="shop") */ private $shopUrls; /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set name. * * @param string $name * * @return Shop */ public function setName($name) { $this->name = $name; return $this; } /** * Get name. * * @return string */ public function getName() { return $this->name; } /** * @param string $color * * @return Shop */ public function setColor(string $color): Shop { $this->color = $color; return $this; } /** * @return string */ public function getColor(): ?string { return $this->color; } /** * Set idCategory. * * @param int $idCategory * * @return Shop */ public function setIdCategory($idCategory) { $this->idCategory = $idCategory; return $this; } /** * Get idCategory. * * @return int */ public function getIdCategory() { return $this->idCategory; } /** * Set themeName. * * @param string $themeName * * @return Shop */ public function setThemeName($themeName) { $this->themeName = $themeName; return $this; } /** * Get themeName. * * @return string */ public function getThemeName() { return $this->themeName; } /** * Set active. * * @param bool $active * * @return Shop */ public function setActive($active) { $this->active = $active; return $this; } /** * Get active. * * @return bool */ public function getActive() { return $this->active; } /** * Set deleted. * * @param bool $deleted * * @return Shop */ public function setDeleted($deleted) { $this->deleted = $deleted; return $this; } /** * Get deleted. * * @return bool */ public function getDeleted() { return $this->deleted; } /** * Set shopGroup. * * @param \PrestaShopBundle\Entity\ShopGroup $shopGroup * * @return Shop */ public function setShopGroup(ShopGroup $shopGroup) { $this->shopGroup = $shopGroup; return $this; } /** * Get shopGroup. * * @return \PrestaShopBundle\Entity\ShopGroup */ public function getShopGroup() { return $this->shopGroup; } /** * @return Collection */ public function getShopUrls(): Collection { return $this->shopUrls; } /** * @return bool */ public function hasMainUrl(): bool { foreach ($this->shopUrls as $shopUrl) { if ($shopUrl->getActive() && $shopUrl->getMain()) { return true; } } return false; } }