<?php
declare(strict_types=1);
namespace App\Entity;
use App\Repository\MasjidRepository;
use DateTime;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
use Knp\DoctrineBehaviors\Model\Sluggable\SluggableTrait;
/**
* @ORM\Entity(repositoryClass=MasjidRepository::class)
*/
class Masjid implements TranslatableInterface, SluggableInterface
{
use SluggableTrait;
use TranslatableTrait;
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $latitude;
/**
* @ORM\Column(type="string", length=255)
*/
private $longitude;
/**
* @ORM\Column(type="datetime")
*/
private $dateOfConsctruct;
/**
* @ORM\Column(type="string", length=255)
*/
private $style;
/**
* @ORM\Column(type="string", length=255)
*/
private $surface;
/**
* @ORM\Column(type="string", length=255)
*/
private $height;
/**
* @ORM\Column(type="boolean")
*/
private $isWomen;
/**
* @ORM\Column(type="boolean")
*/
private $isEnglish;
/**
* @ORM\Column(type="string", length=255)
*/
private $Imam;
/**
* @ORM\Column(type="string", length=255)
*/
private $sidePic;
/**
* @ORM\Column(type="string", length=255)
*/
private $namePlatePic;
/**
* @ORM\Column(type="string", length=255)
*/
private $entryPic;
/**
* @ORM\Column(type="string", length=255)
*/
private $MainPic;
/**
* @ORM\ManyToOne(targetEntity=Community::class,inversedBy="masjids", fetch="EAGER")
* @ORM\JoinColumn(nullable=false)
*/
private $community;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Num;
/**
* @ORM\Column(type="string", length=255)
*/
private $CommunityName;
/**
* @ORM\Column(type="boolean")
*/
private $isJumah;
/**
* @ORM\OneToMany(targetEntity=Comment::class, mappedBy="masjid", orphanRemoval=true)
*/
private $comments;
/**
* @ORM\OneToMany(targetEntity=Picture::class, mappedBy="masjid")
*/
private $pictures;
public function __toString()
{
return (string) $this->getName();
}
public function __construct()
{
$this->comments = new ArrayCollection();
$this->pictures = new ArrayCollection();
$this->dateOfConsctruct = new DateTime('now');
$this->MainPic = "NC.jpg";
$this->entryPic = "NC.jpg";
$this->sidePic = "NC.jpg";
$this->height = "NC";
$this->surface = "NC";
$this->style = "NC";
$this->namePlatePic = "NC";
$this->Imam = "NC";
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getLatitude(): ?string
{
return $this->latitude;
}
public function setLatitude(string $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?string
{
return $this->longitude;
}
public function setLongitude(string $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getDateOfConsctruct(): ?DateTimeInterface
{
return $this->dateOfConsctruct;
}
public function setDateOfConsctruct(DateTimeInterface $dateOfConsctruct): self
{
$this->dateOfConsctruct = $dateOfConsctruct;
return $this;
}
public function getStyle(): ?string
{
return $this->style;
}
public function setStyle(string $style): self
{
$this->style = $style;
return $this;
}
public function getSurface(): ?string
{
return $this->surface;
}
public function setSurface(string $surface): self
{
$this->surface = $surface;
return $this;
}
public function getHeight(): ?string
{
return $this->height;
}
public function setHeight(string $height): self
{
$this->height = $height;
return $this;
}
public function getIsWomen(): ?bool
{
return $this->isWomen;
}
public function setIsWomen(bool $isWomen): self
{
$this->isWomen = $isWomen;
return $this;
}
public function getIsEnglish(): ?bool
{
return $this->isEnglish;
}
public function setIsEnglish(bool $isEnglish): self
{
$this->isEnglish = $isEnglish;
return $this;
}
public function getImam(): ?string
{
return $this->Imam;
}
public function setImam(string $Imam): self
{
$this->Imam = $Imam;
return $this;
}
public function getSidePic(): ?string
{
return $this->sidePic;
}
public function setSidePic(string $sidePic): self
{
$this->sidePic = $sidePic;
return $this;
}
public function getNamePlatePic(): ?string
{
return $this->namePlatePic;
}
public function setNamePlatePic(string $namePlatePic): self
{
$this->namePlatePic = $namePlatePic;
return $this;
}
public function getEntryPic(): ?string
{
return $this->entryPic;
}
public function setEntryPic(string $entryPic): self
{
$this->entryPic = $entryPic;
return $this;
}
public function getMainPic(): ?string
{
return $this->MainPic;
}
public function setMainPic(string $MainPic): self
{
$this->MainPic = $MainPic;
return $this;
}
public function getCommunity(): ?Community
{
return $this->community;
}
public function setCommunity(?Community $community): self
{
$this->community = $community;
return $this;
}
public function getNum(): ?string
{
return $this->Num;
}
public function setNum(?string $Num): self
{
$this->Num = $Num;
return $this;
}
public function getCommunityName(): ?string
{
return $this->CommunityName;
}
public function setCommunityName(string $CommunityName): self
{
$this->CommunityName = $CommunityName;
return $this;
}
public function getIsJumah(): ?bool
{
return $this->isJumah;
}
public function setIsJumah(bool $isJumah): self
{
$this->isJumah = $isJumah;
return $this;
}
/**
* @return Collection|Comment[]
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments[] = $comment;
$comment->setMasjid($this);
}
return $this;
}
public function removeComment(Comment $comment): self
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getMasjid() === $this) {
$comment->setMasjid(null);
}
}
return $this;
}
/**
* @return Collection|Picture[]
*/
public function getPictures(): Collection
{
return $this->pictures;
}
public function addPicture(Picture $picture): self
{
if (!$this->pictures->contains($picture)) {
$this->pictures[] = $picture;
$picture->setMasjid($this);
}
return $this;
}
public function removePicture(Picture $picture): self
{
if ($this->pictures->removeElement($picture)) {
// set the owning side to null (unless already changed)
if ($picture->getMasjid() === $this) {
$picture->setMasjid(null);
}
}
return $this;
}
/**
* @return string[]
*/
public function getSluggableFields(): array
{
return ["name"];
}
public function generateSlugValue($values): string
{
return implode('-', $values);
}
public function shouldRegenerateSlugOnUpdate(): bool{
return false;
}
public function getDescription(): ?string
{
return $this->translate(null, false)->getDescription();
}
public function setDescription(?string $description): void
{
$this->translate(null, false)->setDescription($description);
}
}