src/Entity/StorePage.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Enum\HighlitedStaffSpecialityEnum;
  4. use App\Repository\StorePageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use Vich\UploaderBundle\Entity\File;
  10. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  11. /**
  12.  * @ORM\Entity(repositoryClass=StorePageRepository::class)
  13.  * @Vich\Uploadable
  14.  * */
  15. class StorePage
  16. {
  17.     /**
  18.      * @ORM\Id()
  19.      * @ORM\GeneratedValue()
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="text", nullable=true)
  25.      */
  26.     private $description;
  27.     /**
  28.      * @ORM\OneToOne(targetEntity=Store::class, mappedBy="storePage")
  29.      */
  30.     private $store;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=StoreEmployee::class, mappedBy="storePage", orphanRemoval=true, cascade={"persist"})
  33.      */
  34.     private $employees;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=StoreImage::class, mappedBy="storePage", orphanRemoval=true, cascade={"persist"})
  37.      */
  38.     private $storeImages;
  39.     /**
  40.      * @ORM\ManyToMany(targetEntity=HearingMaker::class)
  41.      */
  42.     private $hearingMaker;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private $websiteUrl;
  47.     /**
  48.      * @ORM\ManyToMany(targetEntity=CareNetwork::class)
  49.      */
  50.     private $careNetworks;
  51.     /**
  52.      * @ORM\Column(type="datetime", nullable=true)
  53.      */
  54.     private $updatedAt;
  55.     /**
  56.      * @ORM\ManyToMany(targetEntity=StoreSpeciality::class)
  57.      */
  58.     private $speciality;
  59.     /**
  60.      * @ORM\ManyToMany(targetEntity=StoreService::class)
  61.      */
  62.     private $service;
  63.     /**
  64.      * @ORM\Column(type="string", length=50, nullable=true)
  65.      */
  66.     private $highlightedStaffName;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      */
  70.     private $highlightedStaffPicturePath;
  71.     /**
  72.      * @Assert\File(mimeTypes = {"image/jpeg", "image/png", "image/gif", "image/jpg"})
  73.      * @Vich\UploadableField(mapping="highlighted_staff_picture", fileNameProperty="highlightedStaffPicturePath")
  74.      * @var File
  75.      */
  76.     private $highlightedStaffPictureFile;
  77.     /**
  78.      * @ORM\Column(type="string", length=100, nullable=true)
  79.      */
  80.     private $highlightedStaffJob;
  81.     /**
  82.      * @ORM\Column(type="text", nullable=true)
  83.      * @Assert\Length(max="400")
  84.      */
  85.     private $highlightedStaffDescription;
  86.     /**
  87.      * @ORM\Column(type="integer", nullable=true)
  88.      */
  89.     private $highlitedStaffSpeciality;
  90.     public function __construct()
  91.     {
  92.         $this->employees = new ArrayCollection();
  93.         $this->storeImages = new ArrayCollection();
  94.         $this->hearingMaker = new ArrayCollection();
  95.         $this->careNetworks = new ArrayCollection();
  96.         $this->speciality = new ArrayCollection();
  97.         $this->service = new ArrayCollection();
  98.     }
  99.     /**
  100.      * @return mixed
  101.      */
  102.     public function getUpdatedAt(): ?\DateTimeInterface
  103.     {
  104.         return $this->updatedAt;
  105.     }
  106.     /**
  107.      * @param mixed $updatedAt
  108.      */
  109.     public function setUpdatedAt(?\DateTimeInterface  $updatedAt): self
  110.     {
  111.         $this->updatedAt $updatedAt;
  112.         return $this;
  113.     }
  114.     public function getId(): ?int
  115.     {
  116.         return $this->id;
  117.     }
  118.     public function getDescription(): ?string
  119.     {
  120.         return $this->description;
  121.     }
  122.     public function setDescription(?string $description): self
  123.     {
  124.         $this->description $description;
  125.         return $this;
  126.     }
  127.     public function getStore(): ?Store
  128.     {
  129.         return $this->store;
  130.     }
  131.     public function setStore(?Store $store): self
  132.     {
  133.         $this->store $store;
  134.         // set (or unset) the owning side of the relation if necessary
  135.         $newStorePage null === $store null $this;
  136.         if ($store->getStorePage() !== $newStorePage) {
  137.             $store->setStorePage($newStorePage);
  138.         }
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection|StoreEmployee[]
  143.      */
  144.     public function getEmployees(): Collection
  145.     {
  146.         return $this->employees;
  147.     }
  148.     /**
  149.      * does this store have employee
  150.      * @return bool
  151.      */
  152.     public function hasEmployee(): bool {
  153.         return !$this->employees->isEmpty();
  154.     }
  155.     public function addEmployee(StoreEmployee $employee): self
  156.     {
  157.         if (!$this->employees->contains($employee)) {
  158.             $this->employees[] = $employee;
  159.             $employee->setStorePage($this);
  160.         }
  161.         return $this;
  162.     }
  163.     public function removeEmployee(StoreEmployee $employee): self
  164.     {
  165.         if ($this->employees->contains($employee)) {
  166.             $this->employees->removeElement($employee);
  167.             // set the owning side to null (unless already changed)
  168.             if ($employee->getStorePage() === $this) {
  169.                 $employee->setStorePage(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection|StoreImage[]
  176.      */
  177.     public function getStoreImages(): Collection
  178.     {
  179.         return $this->storeImages;
  180.     }
  181.     /**
  182.      * @return bool
  183.      */
  184.     public function hasStoreImages(): bool
  185.     {
  186.         return !$this->storeImages->isEmpty();
  187.     }
  188.     public function addStoreImage(StoreImage $storeImage): self
  189.     {
  190.         if (!$this->storeImages->contains($storeImage)) {
  191.             $this->storeImages[] = $storeImage;
  192.             $storeImage->setStorePage($this);
  193.         }
  194.         return $this;
  195.     }
  196.     public function removeStoreImage(StoreImage $storeImage): self
  197.     {
  198.         if ($this->storeImages->contains($storeImage)) {
  199.             $this->storeImages->removeElement($storeImage);
  200.             // set the owning side to null (unless already changed)
  201.             if ($storeImage->getStorePage() === $this) {
  202.                 $storeImage->setStorePage(null);
  203.             }
  204.         }
  205.         return $this;
  206.     }
  207.     /**
  208.      * @return Collection|HearingMaker[]
  209.      */
  210.     public function getHearingMaker(): Collection
  211.     {
  212.         return $this->hearingMaker;
  213.     }
  214.     public function hasHearingMaker(): bool
  215.     {
  216.         return ! $this->hearingMaker->isEmpty();
  217.     }
  218.     public function addHearingMaker(HearingMaker $hearingMaker): self
  219.     {
  220.         if (!$this->hearingMaker->contains($hearingMaker)) {
  221.             $this->hearingMaker[] = $hearingMaker;
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeHearingMaker(HearingMaker $hearingMaker): self
  226.     {
  227.         if ($this->hearingMaker->contains($hearingMaker)) {
  228.             $this->hearingMaker->removeElement($hearingMaker);
  229.         }
  230.         return $this;
  231.     }
  232.     public function getWebsiteUrl(): ?string
  233.     {
  234.         return $this->websiteUrl;
  235.     }
  236.     public function setWebsiteUrl(?string $websiteUrl): self
  237.     {
  238.         $this->websiteUrl $websiteUrl;
  239.         return $this;
  240.     }
  241.     /**
  242.      * @return Collection|CareNetwork[]
  243.      */
  244.     public function getCareNetworks(): Collection
  245.     {
  246.         return $this->careNetworks;
  247.     }
  248.     public function addCareNetwork(CareNetwork $careNetwork): self
  249.     {
  250.         if (!$this->careNetworks->contains($careNetwork)) {
  251.             $this->careNetworks[] = $careNetwork;
  252.         }
  253.         return $this;
  254.     }
  255.     public function hasCareNetwork(): bool
  256.     {
  257.         return ! $this->careNetworks->isEmpty();
  258.     }
  259.     public function removeCareNetwork(CareNetwork $careNetwork): self
  260.     {
  261.         if ($this->careNetworks->contains($careNetwork)) {
  262.             $this->careNetworks->removeElement($careNetwork);
  263.         }
  264.         return $this;
  265.     }
  266.     /**
  267.      * @return Collection<int, StoreSpeciality>
  268.      */
  269.     public function getSpeciality(): Collection
  270.     {
  271.         return $this->speciality;
  272.     }
  273.     public function addSpeciality(StoreSpeciality $speciality): self
  274.     {
  275.         if (!$this->speciality->contains($speciality)) {
  276.             $this->speciality[] = $speciality;
  277.         }
  278.         return $this;
  279.     }
  280.     public function removeSpeciality(StoreSpeciality $speciality): self
  281.     {
  282.         $this->speciality->removeElement($speciality);
  283.         return $this;
  284.     }
  285.     /**
  286.      * @return Collection<int, StoreService>
  287.      */
  288.     public function getService(): Collection
  289.     {
  290.         return $this->service;
  291.     }
  292.     public function addService(StoreService $service): self
  293.     {
  294.         if (!$this->service->contains($service)) {
  295.             $this->service[] = $service;
  296.         }
  297.         return $this;
  298.     }
  299.     public function removeService(StoreService $service): self
  300.     {
  301.         $this->service->removeElement($service);
  302.         return $this;
  303.     }
  304.     public function hasHighlightedStaff(): bool {
  305.         if(
  306.             $this->getHighlightedStaffName() !== null
  307.             && $this->getHighlightedStaffDescription() !== null
  308.             && $this->getHighlightedStaffJob() !== null
  309.             && $this->getHighlitedStaffSpeciality() !== null
  310.             && $this->getHighlightedStaffPicturePath() !== null
  311.         ){
  312.             return true;
  313.         } else {
  314.             return false;
  315.         }
  316.     }
  317.     public function getHighlightedStaffName(): ?string
  318.     {
  319.         return $this->highlightedStaffName;
  320.     }
  321.     public function setHighlightedStaffName(?string $highlightedStaffName): self
  322.     {
  323.         $this->highlightedStaffName $highlightedStaffName;
  324.         return $this;
  325.     }
  326.     public function getHighlightedStaffJob(): ?string
  327.     {
  328.         return $this->highlightedStaffJob;
  329.     }
  330.     public function setHighlightedStaffJob(?string $highlightedStaffJob): self
  331.     {
  332.         $this->highlightedStaffJob $highlightedStaffJob;
  333.         return $this;
  334.     }
  335.     public function getHighlightedStaffDescription(): ?string
  336.     {
  337.         return $this->highlightedStaffDescription;
  338.     }
  339.     public function setHighlightedStaffDescription(?string $highlightedStaffDescription): self
  340.     {
  341.         $this->highlightedStaffDescription $highlightedStaffDescription;
  342.         return $this;
  343.     }
  344.     public function getHighlitedStaffSpeciality(): ?int
  345.     {
  346.         return $this->highlitedStaffSpeciality;
  347.     }
  348.     public function getHighlitedStaffSpecialityName(): ?string
  349.     {
  350.         if($this->highlitedStaffSpeciality) {
  351.             return HighlitedStaffSpecialityEnum::getName($this->highlitedStaffSpeciality);
  352.         } else {
  353.             return '';
  354.         }
  355.     }
  356.     public function setHighlitedStaffSpeciality(?int $highlitedStaffSpeciality): self
  357.     {
  358.         $this->highlitedStaffSpeciality $highlitedStaffSpeciality;
  359.         return $this;
  360.     }
  361.     /**
  362.      * @return mixed
  363.      */
  364.     public function getHighlightedStaffPicturePath()
  365.     {
  366.         return $this->highlightedStaffPicturePath;
  367.     }
  368.     /**
  369.      * @param mixed $highlightedStaffPicturePath
  370.      */
  371.     public function setHighlightedStaffPicturePath($highlightedStaffPicturePath): void
  372.     {
  373.         $this->highlightedStaffPicturePath $highlightedStaffPicturePath;
  374.     }
  375.     public function getHighlightedStaffPictureFile()
  376.     {
  377.         return $this->highlightedStaffPictureFile;
  378.     }
  379.     public function setHighlightedStaffPictureFile($highlightedStaffPictureFile): void
  380.     {
  381.         $this->highlightedStaffPictureFile $highlightedStaffPictureFile;
  382.         if (null !== $highlightedStaffPictureFile) {
  383.             // It is required that at least one field changes if you are using doctrine
  384.             // otherwise the event listeners won't be called and the file is lost
  385.             $this->updatedAt = new \DateTimeImmutable();
  386.         }
  387.     }
  388. }