src/Entity/Restaurants/Restaurants.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Restaurants;
  3. use App\Entity\Localizations\Cities;
  4. use App\Entity\Common\DatesTrait;
  5. use App\Entity\Common\IdTrait;
  6. use App\Entity\Common\OrdreTrait;
  7. use App\Entity\Common\SlugTrait;
  8. use App\Entity\User;
  9. use DateTime;
  10. use DateTimeImmutable;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Exception;
  15. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  16. use Symfony\Component\HttpFoundation\File\File;
  17. use Symfony\Component\HttpFoundation\File\UploadedFile;
  18. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  19. use Symfony\Component\Validator\Constraints as Assert;
  20. /**
  21.  * @ORM\Entity(repositoryClass="App\Repository\Restaurants\RestaurantsRepository")
  22.  * @UniqueEntity("name")
  23.  * @Vich\Uploadable
  24.  */
  25. class Restaurants
  26. {
  27.     use IdTrait;
  28.     use OrdreTrait;
  29.     use DatesTrait;
  30.     use SlugTrait;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      * @Assert\NotBlank(message="Veuillez saisir le nom de votre restaurant")
  34.      */
  35.     private $name;
  36.     /**
  37.      * @ORM\Column(type="text", nullable=true)
  38.      */
  39.     private $description;
  40.     /**
  41.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  42.      *
  43.      * @Vich\UploadableField(mapping="restaurants_image", fileNameProperty="filename")
  44.      * @var File|null
  45.      * @Assert\Image(
  46.      *     mimeTypes={"image/jpeg", "image/png"},
  47.      *
  48.      *     maxHeight=1280,
  49.      *     maxWidth=1920,
  50.      *     maxHeightMessage="Votre image doit faire 1280 d'hauteur",
  51.      *     maxWidthMessage="Votre image doit faire 1920 de largeur"
  52.      * )
  53.      */
  54.     private $imageFile;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private $filename;
  59.     /**
  60.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  61.      *
  62.      * @Vich\UploadableField(mapping="restaurants_image", fileNameProperty="bandeaufile")
  63.      * @var File|null
  64.      * @Assert\Image(
  65.      *     mimeTypes={"image/jpeg", "image/png"},
  66.      *
  67.      *     maxHeight=710,
  68.      *     maxWidth=1920,
  69.      *     maxHeightMessage="Votre image doit faire 710 d'hauteur",
  70.      *     maxWidthMessage="Votre image doit faire 1920 de largeur"
  71.      * )
  72.      */
  73.     private $bandeauImageFile;
  74.     /**
  75.      * @ORM\Column(type="string", length=255, nullable=true)
  76.      */
  77.     private $bandeaufile;
  78.     /**
  79.      * @ORM\Column(type="string", length=500, nullable=true)
  80.      */
  81.     private $address;
  82.     /**
  83.      * @ORM\Column(type="string", length=255, nullable=true)
  84.      */
  85.     private $type;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $contacts;
  90.     /**
  91.      * @ORM\Column(type="string", length=255)
  92.      * @Assert\NotBlank(message="Veuillez saisir un email")
  93.      * @Assert\Email(message="Veuillez saisir un email valide")
  94.      */
  95.     private $email;
  96.     /**
  97.      * @ORM\Column(type="string", length=255, nullable=true)
  98.      */
  99.     private $siteweb;
  100.     /**
  101.      * @ORM\Column(type="string", length=255, nullable=true)
  102.      */
  103.     private $facebook;
  104.     /**
  105.      * @ORM\Column(type="string", length=255, nullable=true)
  106.      */
  107.     private $twitter;
  108.     /**
  109.      * @ORM\Column(type="string", length=255, nullable=true)
  110.      */
  111.     private $instagram;
  112.     /**
  113.      * @ORM\Column(type="string", length=255, nullable=true)
  114.      */
  115.     private $ambiance;
  116.     /**
  117.      * @ORM\Column(type="string", length=500, nullable=true)
  118.      */
  119.     private $joursouvrables;
  120.     /**
  121.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="restaurants")
  122.      */
  123.     private $user;
  124.     /**
  125.      * @ORM\Column(type="boolean", options={"default": 0})
  126.      */
  127.     private $online;
  128.     /**
  129.      * @ORM\Column(type="boolean", options={"default": 0})
  130.      */
  131.     private $activated;
  132.     /**
  133.      * @ORM\ManyToMany(targetEntity="App\Entity\Restaurants\Specialites", inversedBy="restaurants")
  134.      */
  135.     private $specialites;
  136.     /**
  137.      * @ORM\ManyToMany(targetEntity="App\Entity\Restaurants\Servicesrestaurants", inversedBy="restaurants")
  138.      */
  139.     private $services;
  140.     /**
  141.      * @ORM\OneToMany(targetEntity="App\Entity\Restaurants\Mediasrestaurants", mappedBy="restaurants")
  142.      */
  143.     private $mediasrestaurants;
  144.     /**
  145.      * @ORM\Column(type="string", length=500, nullable=true)
  146.      */
  147.     private $othersspecialites;
  148.     /**
  149.      * @ORM\Column(type="string", length=500, nullable=true)
  150.      */
  151.     private $othersservices;
  152.     /**
  153.      * @ORM\Column(type="string", length=100, nullable=true)
  154.      */
  155.     private $longitude;
  156.     /**
  157.      * @ORM\Column(type="string", length=100, nullable=true)
  158.      */
  159.     private $latitude;
  160.     /**
  161.      * @ORM\ManyToOne(targetEntity="App\Entity\Localizations\Cities", inversedBy="restaurants")
  162.      */
  163.     private $cities;
  164.     /**
  165.      * @ORM\Column(type="boolean")
  166.      */
  167.     private $featured;
  168.     public function __construct()
  169.     {
  170.         $this->specialites = new ArrayCollection();
  171.         $this->services = new ArrayCollection();
  172.         $this->mediasrestaurants = new ArrayCollection();
  173.     }
  174.     public function getName(): ?string
  175.     {
  176.         return $this->name;
  177.     }
  178.     public function setName(string $name): self
  179.     {
  180.         $this->name $name;
  181.         return $this;
  182.     }
  183.     public function getDescription(): ?string
  184.     {
  185.         return $this->description;
  186.     }
  187.     public function setDescription(?string $description): self
  188.     {
  189.         $this->description $description;
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return File|null
  194.      */
  195.     public function getImageFile(): ?File
  196.     {
  197.         return $this->imageFile;
  198.     }
  199.     /**
  200.      * @param File|null $imageFile
  201.      * @return Restaurants
  202.      * @throws Exception
  203.      */
  204.     public function setImageFile(?File $imageFile): Restaurants
  205.     {
  206.         $this->imageFile $imageFile;
  207.         if ($this->imageFile instanceof UploadedFile) {
  208.             // It is required that at least one field changes if you are using doctrine
  209.             // otherwise the event listeners won't be called and the file is lost
  210.             $this->updatedAt = new DateTimeImmutable('now');
  211.         }
  212.         return $this;
  213.     }
  214.     public function getFilename(): ?string
  215.     {
  216.         return $this->filename;
  217.     }
  218.     public function setFilename(?string $filename): self
  219.     {
  220.         $this->filename $filename;
  221.         return $this;
  222.     }
  223.     /**
  224.      * @return File|null
  225.      */
  226.     public function getBandeauImageFile(): ?File
  227.     {
  228.         return $this->bandeauImageFile;
  229.     }
  230.     /**
  231.      * @param File|null $bandeauImageFile
  232.      * @return Restaurants
  233.      * @throws Exception
  234.      */
  235.     public function setBandeauImageFile(?File $bandeauImageFile): Restaurants
  236.     {
  237.         $this->bandeauImageFile $bandeauImageFile;
  238.         if ($this->bandeauImageFile instanceof UploadedFile) {
  239.             // It is required that at least one field changes if you are using doctrine
  240.             // otherwise the event listeners won't be called and the file is lost
  241.             $this->updatedAt = new DateTimeImmutable('now');
  242.         }
  243.         return $this;
  244.     }
  245.     public function getBandeaufile(): ?string
  246.     {
  247.         return $this->bandeaufile;
  248.     }
  249.     public function setBandeaufile(?string $bandeaufile): self
  250.     {
  251.         $this->bandeaufile $bandeaufile;
  252.         return $this;
  253.     }
  254.     public function getAddress(): ?string
  255.     {
  256.         return $this->address;
  257.     }
  258.     public function setAddress(?string $address): self
  259.     {
  260.         $this->address $address;
  261.         return $this;
  262.     }
  263.     public function getType(): ?string
  264.     {
  265.         return $this->type;
  266.     }
  267.     public function setType(?string $type): self
  268.     {
  269.         $this->type $type;
  270.         return $this;
  271.     }
  272.     public function getContacts(): ?string
  273.     {
  274.         return $this->contacts;
  275.     }
  276.     public function setContacts(?string $contacts): self
  277.     {
  278.         $this->contacts $contacts;
  279.         return $this;
  280.     }
  281.     public function getEmail(): ?string
  282.     {
  283.         return $this->email;
  284.     }
  285.     public function setEmail(string $email): self
  286.     {
  287.         $this->email $email;
  288.         return $this;
  289.     }
  290.     public function getSiteweb(): ?string
  291.     {
  292.         return $this->siteweb;
  293.     }
  294.     public function setSiteweb(?string $siteweb): self
  295.     {
  296.         $this->siteweb $siteweb;
  297.         return $this;
  298.     }
  299.     public function getFacebook(): ?string
  300.     {
  301.         return $this->facebook;
  302.     }
  303.     public function setFacebook(?string $facebook): self
  304.     {
  305.         $this->facebook $facebook;
  306.         return $this;
  307.     }
  308.     public function getTwitter(): ?string
  309.     {
  310.         return $this->twitter;
  311.     }
  312.     public function setTwitter(?string $twitter): self
  313.     {
  314.         $this->twitter $twitter;
  315.         return $this;
  316.     }
  317.     public function getInstagram(): ?string
  318.     {
  319.         return $this->instagram;
  320.     }
  321.     public function setInstagram(?string $instagram): self
  322.     {
  323.         $this->instagram $instagram;
  324.         return $this;
  325.     }
  326.     public function getAmbiance(): ?string
  327.     {
  328.         return $this->ambiance;
  329.     }
  330.     public function setAmbiance(?string $ambiance): self
  331.     {
  332.         $this->ambiance $ambiance;
  333.         return $this;
  334.     }
  335.     public function getJoursouvrables(): ?string
  336.     {
  337.         return $this->joursouvrables;
  338.     }
  339.     public function setJoursouvrables(?string $joursouvrables): self
  340.     {
  341.         $this->joursouvrables $joursouvrables;
  342.         return $this;
  343.     }
  344.     public function getUser(): ?User
  345.     {
  346.         return $this->user;
  347.     }
  348.     public function setUser(?User $user): self
  349.     {
  350.         $this->user $user;
  351.         return $this;
  352.     }
  353.     public function getOnline(): ?bool
  354.     {
  355.         return $this->online;
  356.     }
  357.     public function setOnline(bool $online): self
  358.     {
  359.         $this->online $online;
  360.         return $this;
  361.     }
  362.     public function getActivated(): ?bool
  363.     {
  364.         return $this->activated;
  365.     }
  366.     public function setActivated(bool $activated): self
  367.     {
  368.         $this->activated $activated;
  369.         return $this;
  370.     }
  371.     /**
  372.      * @return Collection|Specialites[]
  373.      */
  374.     public function getSpecialites(): Collection
  375.     {
  376.         return $this->specialites;
  377.     }
  378.     public function addSpecialite(Specialites $specialite): self
  379.     {
  380.         if (!$this->specialites->contains($specialite)) {
  381.             $this->specialites[] = $specialite;
  382.         }
  383.         return $this;
  384.     }
  385.     public function removeSpecialite(Specialites $specialite): self
  386.     {
  387.         if ($this->specialites->contains($specialite)) {
  388.             $this->specialites->removeElement($specialite);
  389.         }
  390.         return $this;
  391.     }
  392.     /**
  393.      * @return Collection|Servicesrestaurants[]
  394.      */
  395.     public function getServices(): Collection
  396.     {
  397.         return $this->services;
  398.     }
  399.     public function addService(Servicesrestaurants $service): self
  400.     {
  401.         if (!$this->services->contains($service)) {
  402.             $this->services[] = $service;
  403.         }
  404.         return $this;
  405.     }
  406.     public function removeService(Servicesrestaurants $service): self
  407.     {
  408.         if ($this->services->contains($service)) {
  409.             $this->services->removeElement($service);
  410.         }
  411.         return $this;
  412.     }
  413.     /**
  414.      * @return Collection|Mediasrestaurants[]
  415.      */
  416.     public function getMediasrestaurants(): Collection
  417.     {
  418.         return $this->mediasrestaurants;
  419.     }
  420.     public function addMediasrestaurant(Mediasrestaurants $mediasrestaurant): self
  421.     {
  422.         if (!$this->mediasrestaurants->contains($mediasrestaurant)) {
  423.             $this->mediasrestaurants[] = $mediasrestaurant;
  424.             $mediasrestaurant->setRestaurants($this);
  425.         }
  426.         return $this;
  427.     }
  428.     public function removeMediasrestaurant(Mediasrestaurants $mediasrestaurant): self
  429.     {
  430.         if ($this->mediasrestaurants->contains($mediasrestaurant)) {
  431.             $this->mediasrestaurants->removeElement($mediasrestaurant);
  432.             // set the owning side to null (unless already changed)
  433.             if ($mediasrestaurant->getRestaurants() === $this) {
  434.                 $mediasrestaurant->setRestaurants(null);
  435.             }
  436.         }
  437.         return $this;
  438.     }
  439.     public function __toString()
  440.     {
  441.         return $this->name;
  442.     }
  443.     public function getOthersspecialites(): ?string
  444.     {
  445.         return $this->othersspecialites;
  446.     }
  447.     public function setOthersspecialites(?string $othersspecialites): self
  448.     {
  449.         $this->othersspecialites $othersspecialites;
  450.         return $this;
  451.     }
  452.     public function getOthersservices(): ?string
  453.     {
  454.         return $this->othersservices;
  455.     }
  456.     public function setOthersservices(?string $othersservices): self
  457.     {
  458.         $this->othersservices $othersservices;
  459.         return $this;
  460.     }
  461.     public function getLongitude(): ?string
  462.     {
  463.         return $this->longitude;
  464.     }
  465.     public function setLongitude(?string $longitude): self
  466.     {
  467.         $this->longitude $longitude;
  468.         return $this;
  469.     }
  470.     public function getLatitude(): ?string
  471.     {
  472.         return $this->latitude;
  473.     }
  474.     public function setLatitude(?string $latitude): self
  475.     {
  476.         $this->latitude $latitude;
  477.         return $this;
  478.     }
  479.     public function getCities(): ?Cities
  480.     {
  481.         return $this->cities;
  482.     }
  483.     public function setCities(?Cities $cities): self
  484.     {
  485.         $this->cities $cities;
  486.         return $this;
  487.     }
  488.     public function getFeatured(): ?bool
  489.     {
  490.         return $this->featured;
  491.     }
  492.     public function setFeatured(bool $featured): self
  493.     {
  494.         $this->featured $featured;
  495.         return $this;
  496.     }
  497. }