src/Entity/Masjid.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Repository\MasjidRepository;
  5. use DateTime;
  6. use DateTimeInterface;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  11. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  12. use Knp\DoctrineBehaviors\Contract\Entity\SluggableInterface;
  13. use Knp\DoctrineBehaviors\Model\Sluggable\SluggableTrait;
  14. /**
  15.  * @ORM\Entity(repositoryClass=MasjidRepository::class)
  16.  */
  17. class Masjid implements TranslatableInterfaceSluggableInterface
  18. {
  19.     use SluggableTrait;
  20.     use TranslatableTrait;
  21.     /**
  22.      * @ORM\Id
  23.      * @ORM\Column(type="integer")
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $name;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $latitude;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $longitude;
  39.     /**
  40.      * @ORM\Column(type="datetime")
  41.      */
  42.     private $dateOfConsctruct;
  43.     /**
  44.      * @ORM\Column(type="string", length=255)
  45.      */
  46.     private $style;
  47.     /**
  48.      * @ORM\Column(type="string", length=255)
  49.      */
  50.     private $surface;
  51.     /**
  52.      * @ORM\Column(type="string", length=255)
  53.      */
  54.     private $height;
  55.     /**
  56.      * @ORM\Column(type="boolean")
  57.      */
  58.     private $isWomen;
  59.     /**
  60.      * @ORM\Column(type="boolean")
  61.      */
  62.     private $isEnglish;
  63.     /**
  64.      * @ORM\Column(type="string", length=255)
  65.      */
  66.     private $Imam;
  67.     /**
  68.      * @ORM\Column(type="string", length=255)
  69.      */
  70.     private $sidePic;
  71.     /**
  72.      * @ORM\Column(type="string", length=255)
  73.      */
  74.     private $namePlatePic;
  75.     /**
  76.      * @ORM\Column(type="string", length=255)
  77.      */
  78.     private $entryPic;
  79.     /**
  80.      * @ORM\Column(type="string", length=255)
  81.      */
  82.     private $MainPic;
  83.     /**
  84.      * @ORM\ManyToOne(targetEntity=Community::class,inversedBy="masjids", fetch="EAGER")
  85.      * @ORM\JoinColumn(nullable=false)
  86.      */
  87.     private $community;
  88.     /**
  89.      * @ORM\Column(type="string", length=255, nullable=true)
  90.      */
  91.     private $Num;
  92.     /**
  93.      * @ORM\Column(type="string", length=255)
  94.      */
  95.     private $CommunityName;
  96.     /**
  97.      * @ORM\Column(type="boolean")
  98.      */
  99.     private $isJumah;
  100.     /**
  101.      * @ORM\OneToMany(targetEntity=Comment::class, mappedBy="masjid", orphanRemoval=true)
  102.      */
  103.     private $comments;
  104.     /**
  105.      * @ORM\OneToMany(targetEntity=Picture::class, mappedBy="masjid")
  106.      */
  107.     private $pictures;
  108.     public function __toString()
  109.     {
  110.         return (string) $this->getName();
  111.     }
  112.     public function __construct()
  113.     {
  114.         $this->comments = new ArrayCollection();
  115.         $this->pictures = new ArrayCollection();
  116.         $this->dateOfConsctruct = new DateTime('now');
  117.         $this->MainPic "NC.jpg";
  118.         $this->entryPic "NC.jpg";
  119.         $this->sidePic "NC.jpg";
  120.         $this->height "NC";
  121.         $this->surface "NC";
  122.         $this->style "NC";
  123.         $this->namePlatePic "NC";
  124.         $this->Imam "NC";
  125.     }
  126.     public function getId(): ?int
  127.     {
  128.         return $this->id;
  129.     }
  130.     public function getName(): ?string
  131.     {
  132.         return $this->name;
  133.     }
  134.     public function setName(string $name): self
  135.     {
  136.         $this->name $name;
  137.         return $this;
  138.     }
  139.     public function getLatitude(): ?string
  140.     {
  141.         return $this->latitude;
  142.     }
  143.     public function setLatitude(string $latitude): self
  144.     {
  145.         $this->latitude $latitude;
  146.         return $this;
  147.     }
  148.     public function getLongitude(): ?string
  149.     {
  150.         return $this->longitude;
  151.     }
  152.     public function setLongitude(string $longitude): self
  153.     {
  154.         $this->longitude $longitude;
  155.         return $this;
  156.     }
  157.     public function getDateOfConsctruct(): ?DateTimeInterface
  158.     {
  159.         return $this->dateOfConsctruct;
  160.     }
  161.     public function setDateOfConsctruct(DateTimeInterface $dateOfConsctruct): self
  162.     {
  163.         $this->dateOfConsctruct $dateOfConsctruct;
  164.         return $this;
  165.     }
  166.     public function getStyle(): ?string
  167.     {
  168.         return $this->style;
  169.     }
  170.     public function setStyle(string $style): self
  171.     {
  172.         $this->style $style;
  173.         return $this;
  174.     }
  175.     public function getSurface(): ?string
  176.     {
  177.         return $this->surface;
  178.     }
  179.     public function setSurface(string $surface): self
  180.     {
  181.         $this->surface $surface;
  182.         return $this;
  183.     }
  184.     public function getHeight(): ?string
  185.     {
  186.         return $this->height;
  187.     }
  188.     public function setHeight(string $height): self
  189.     {
  190.         $this->height $height;
  191.         return $this;
  192.     }
  193.     public function getIsWomen(): ?bool
  194.     {
  195.         return $this->isWomen;
  196.     }
  197.     public function setIsWomen(bool $isWomen): self
  198.     {
  199.         $this->isWomen $isWomen;
  200.         return $this;
  201.     }
  202.     public function getIsEnglish(): ?bool
  203.     {
  204.         return $this->isEnglish;
  205.     }
  206.     public function setIsEnglish(bool $isEnglish): self
  207.     {
  208.         $this->isEnglish $isEnglish;
  209.         return $this;
  210.     }
  211.     public function getImam(): ?string
  212.     {
  213.         return $this->Imam;
  214.     }
  215.     public function setImam(string $Imam): self
  216.     {
  217.         $this->Imam $Imam;
  218.         return $this;
  219.     }
  220.     public function getSidePic(): ?string
  221.     {
  222.         return $this->sidePic;
  223.     }
  224.     public function setSidePic(string $sidePic): self
  225.     {
  226.         $this->sidePic $sidePic;
  227.         return $this;
  228.     }
  229.     public function getNamePlatePic(): ?string
  230.     {
  231.         return $this->namePlatePic;
  232.     }
  233.     public function setNamePlatePic(string $namePlatePic): self
  234.     {
  235.         $this->namePlatePic $namePlatePic;
  236.         return $this;
  237.     }
  238.     public function getEntryPic(): ?string
  239.     {
  240.         return $this->entryPic;
  241.     }
  242.     public function setEntryPic(string $entryPic): self
  243.     {
  244.         $this->entryPic $entryPic;
  245.         return $this;
  246.     }
  247.     public function getMainPic(): ?string
  248.     {
  249.         return $this->MainPic;
  250.     }
  251.     public function setMainPic(string $MainPic): self
  252.     {
  253.         $this->MainPic $MainPic;
  254.         return $this;
  255.     }
  256.     public function getCommunity(): ?Community
  257.     {
  258.         return $this->community;
  259.     }
  260.     public function setCommunity(?Community $community): self
  261.     {
  262.         $this->community $community;
  263.         return $this;
  264.     }
  265.     public function getNum(): ?string
  266.     {
  267.         return $this->Num;
  268.     }
  269.     public function setNum(?string $Num): self
  270.     {
  271.         $this->Num $Num;
  272.         return $this;
  273.     }
  274.     public function getCommunityName(): ?string
  275.     {
  276.         return $this->CommunityName;
  277.     }
  278.     public function setCommunityName(string $CommunityName): self
  279.     {
  280.         $this->CommunityName $CommunityName;
  281.         return $this;
  282.     }
  283.     public function getIsJumah(): ?bool
  284.     {
  285.         return $this->isJumah;
  286.     }
  287.     public function setIsJumah(bool $isJumah): self
  288.     {
  289.         $this->isJumah $isJumah;
  290.         return $this;
  291.     }
  292.     /**
  293.      * @return Collection|Comment[]
  294.      */
  295.     public function getComments(): Collection
  296.     {
  297.         return $this->comments;
  298.     }
  299.     public function addComment(Comment $comment): self
  300.     {
  301.         if (!$this->comments->contains($comment)) {
  302.             $this->comments[] = $comment;
  303.             $comment->setMasjid($this);
  304.         }
  305.         return $this;
  306.     }
  307.     public function removeComment(Comment $comment): self
  308.     {
  309.         if ($this->comments->removeElement($comment)) {
  310.             // set the owning side to null (unless already changed)
  311.             if ($comment->getMasjid() === $this) {
  312.                 $comment->setMasjid(null);
  313.             }
  314.         }
  315.         return $this;
  316.     }
  317.     /**
  318.      * @return Collection|Picture[]
  319.      */
  320.     public function getPictures(): Collection
  321.     {
  322.         return $this->pictures;
  323.     }
  324.     public function addPicture(Picture $picture): self
  325.     {
  326.         if (!$this->pictures->contains($picture)) {
  327.             $this->pictures[] = $picture;
  328.             $picture->setMasjid($this);
  329.         }
  330.         return $this;
  331.     }
  332.     public function removePicture(Picture $picture): self
  333.     {
  334.         if ($this->pictures->removeElement($picture)) {
  335.             // set the owning side to null (unless already changed)
  336.             if ($picture->getMasjid() === $this) {
  337.                 $picture->setMasjid(null);
  338.             }
  339.         }
  340.         return $this;
  341.     }
  342.         /**
  343.          * @return string[]
  344.          */
  345.         public function getSluggableFields(): array
  346.         {
  347.             return ["name"];
  348.         }
  349.         public function generateSlugValue($values): string
  350.         {
  351.             return implode('-'$values);
  352.         }
  353.         public function shouldRegenerateSlugOnUpdate(): bool{
  354.            return false;
  355.         }
  356.         public function getDescription(): ?string
  357.         {
  358.             return $this->translate(nullfalse)->getDescription();
  359.         }
  360.         public function setDescription(?string $description): void
  361.         {
  362.             $this->translate(nullfalse)->setDescription($description);
  363.         }
  364. }