<?php
namespace App\Entity;
use App\Entity\Enum\HighlitedStaffSpecialityEnum;
use App\Repository\StorePageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Entity\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=StorePageRepository::class)
* @Vich\Uploadable
* */
class StorePage
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\OneToOne(targetEntity=Store::class, mappedBy="storePage")
*/
private $store;
/**
* @ORM\OneToMany(targetEntity=StoreEmployee::class, mappedBy="storePage", orphanRemoval=true, cascade={"persist"})
*/
private $employees;
/**
* @ORM\OneToMany(targetEntity=StoreImage::class, mappedBy="storePage", orphanRemoval=true, cascade={"persist"})
*/
private $storeImages;
/**
* @ORM\ManyToMany(targetEntity=HearingMaker::class)
*/
private $hearingMaker;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $websiteUrl;
/**
* @ORM\ManyToMany(targetEntity=CareNetwork::class)
*/
private $careNetworks;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\ManyToMany(targetEntity=StoreSpeciality::class)
*/
private $speciality;
/**
* @ORM\ManyToMany(targetEntity=StoreService::class)
*/
private $service;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $highlightedStaffName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $highlightedStaffPicturePath;
/**
* @Assert\File(mimeTypes = {"image/jpeg", "image/png", "image/gif", "image/jpg"})
* @Vich\UploadableField(mapping="highlighted_staff_picture", fileNameProperty="highlightedStaffPicturePath")
* @var File
*/
private $highlightedStaffPictureFile;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $highlightedStaffJob;
/**
* @ORM\Column(type="text", nullable=true)
* @Assert\Length(max="400")
*/
private $highlightedStaffDescription;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $highlitedStaffSpeciality;
public function __construct()
{
$this->employees = new ArrayCollection();
$this->storeImages = new ArrayCollection();
$this->hearingMaker = new ArrayCollection();
$this->careNetworks = new ArrayCollection();
$this->speciality = new ArrayCollection();
$this->service = new ArrayCollection();
}
/**
* @return mixed
*/
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
/**
* @param mixed $updatedAt
*/
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getStore(): ?Store
{
return $this->store;
}
public function setStore(?Store $store): self
{
$this->store = $store;
// set (or unset) the owning side of the relation if necessary
$newStorePage = null === $store ? null : $this;
if ($store->getStorePage() !== $newStorePage) {
$store->setStorePage($newStorePage);
}
return $this;
}
/**
* @return Collection|StoreEmployee[]
*/
public function getEmployees(): Collection
{
return $this->employees;
}
/**
* does this store have employee
* @return bool
*/
public function hasEmployee(): bool {
return !$this->employees->isEmpty();
}
public function addEmployee(StoreEmployee $employee): self
{
if (!$this->employees->contains($employee)) {
$this->employees[] = $employee;
$employee->setStorePage($this);
}
return $this;
}
public function removeEmployee(StoreEmployee $employee): self
{
if ($this->employees->contains($employee)) {
$this->employees->removeElement($employee);
// set the owning side to null (unless already changed)
if ($employee->getStorePage() === $this) {
$employee->setStorePage(null);
}
}
return $this;
}
/**
* @return Collection|StoreImage[]
*/
public function getStoreImages(): Collection
{
return $this->storeImages;
}
/**
* @return bool
*/
public function hasStoreImages(): bool
{
return !$this->storeImages->isEmpty();
}
public function addStoreImage(StoreImage $storeImage): self
{
if (!$this->storeImages->contains($storeImage)) {
$this->storeImages[] = $storeImage;
$storeImage->setStorePage($this);
}
return $this;
}
public function removeStoreImage(StoreImage $storeImage): self
{
if ($this->storeImages->contains($storeImage)) {
$this->storeImages->removeElement($storeImage);
// set the owning side to null (unless already changed)
if ($storeImage->getStorePage() === $this) {
$storeImage->setStorePage(null);
}
}
return $this;
}
/**
* @return Collection|HearingMaker[]
*/
public function getHearingMaker(): Collection
{
return $this->hearingMaker;
}
public function hasHearingMaker(): bool
{
return ! $this->hearingMaker->isEmpty();
}
public function addHearingMaker(HearingMaker $hearingMaker): self
{
if (!$this->hearingMaker->contains($hearingMaker)) {
$this->hearingMaker[] = $hearingMaker;
}
return $this;
}
public function removeHearingMaker(HearingMaker $hearingMaker): self
{
if ($this->hearingMaker->contains($hearingMaker)) {
$this->hearingMaker->removeElement($hearingMaker);
}
return $this;
}
public function getWebsiteUrl(): ?string
{
return $this->websiteUrl;
}
public function setWebsiteUrl(?string $websiteUrl): self
{
$this->websiteUrl = $websiteUrl;
return $this;
}
/**
* @return Collection|CareNetwork[]
*/
public function getCareNetworks(): Collection
{
return $this->careNetworks;
}
public function addCareNetwork(CareNetwork $careNetwork): self
{
if (!$this->careNetworks->contains($careNetwork)) {
$this->careNetworks[] = $careNetwork;
}
return $this;
}
public function hasCareNetwork(): bool
{
return ! $this->careNetworks->isEmpty();
}
public function removeCareNetwork(CareNetwork $careNetwork): self
{
if ($this->careNetworks->contains($careNetwork)) {
$this->careNetworks->removeElement($careNetwork);
}
return $this;
}
/**
* @return Collection<int, StoreSpeciality>
*/
public function getSpeciality(): Collection
{
return $this->speciality;
}
public function addSpeciality(StoreSpeciality $speciality): self
{
if (!$this->speciality->contains($speciality)) {
$this->speciality[] = $speciality;
}
return $this;
}
public function removeSpeciality(StoreSpeciality $speciality): self
{
$this->speciality->removeElement($speciality);
return $this;
}
/**
* @return Collection<int, StoreService>
*/
public function getService(): Collection
{
return $this->service;
}
public function addService(StoreService $service): self
{
if (!$this->service->contains($service)) {
$this->service[] = $service;
}
return $this;
}
public function removeService(StoreService $service): self
{
$this->service->removeElement($service);
return $this;
}
public function hasHighlightedStaff(): bool {
if(
$this->getHighlightedStaffName() !== null
&& $this->getHighlightedStaffDescription() !== null
&& $this->getHighlightedStaffJob() !== null
&& $this->getHighlitedStaffSpeciality() !== null
&& $this->getHighlightedStaffPicturePath() !== null
){
return true;
} else {
return false;
}
}
public function getHighlightedStaffName(): ?string
{
return $this->highlightedStaffName;
}
public function setHighlightedStaffName(?string $highlightedStaffName): self
{
$this->highlightedStaffName = $highlightedStaffName;
return $this;
}
public function getHighlightedStaffJob(): ?string
{
return $this->highlightedStaffJob;
}
public function setHighlightedStaffJob(?string $highlightedStaffJob): self
{
$this->highlightedStaffJob = $highlightedStaffJob;
return $this;
}
public function getHighlightedStaffDescription(): ?string
{
return $this->highlightedStaffDescription;
}
public function setHighlightedStaffDescription(?string $highlightedStaffDescription): self
{
$this->highlightedStaffDescription = $highlightedStaffDescription;
return $this;
}
public function getHighlitedStaffSpeciality(): ?int
{
return $this->highlitedStaffSpeciality;
}
public function getHighlitedStaffSpecialityName(): ?string
{
if($this->highlitedStaffSpeciality) {
return HighlitedStaffSpecialityEnum::getName($this->highlitedStaffSpeciality);
} else {
return '';
}
}
public function setHighlitedStaffSpeciality(?int $highlitedStaffSpeciality): self
{
$this->highlitedStaffSpeciality = $highlitedStaffSpeciality;
return $this;
}
/**
* @return mixed
*/
public function getHighlightedStaffPicturePath()
{
return $this->highlightedStaffPicturePath;
}
/**
* @param mixed $highlightedStaffPicturePath
*/
public function setHighlightedStaffPicturePath($highlightedStaffPicturePath): void
{
$this->highlightedStaffPicturePath = $highlightedStaffPicturePath;
}
public function getHighlightedStaffPictureFile()
{
return $this->highlightedStaffPictureFile;
}
public function setHighlightedStaffPictureFile($highlightedStaffPictureFile): void
{
$this->highlightedStaffPictureFile = $highlightedStaffPictureFile;
if (null !== $highlightedStaffPictureFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
}