<?php
namespace App\Entity\Restaurants;
use App\Entity\Localizations\Cities;
use App\Entity\Common\DatesTrait;
use App\Entity\Common\IdTrait;
use App\Entity\Common\OrdreTrait;
use App\Entity\Common\SlugTrait;
use App\Entity\User;
use DateTime;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\Restaurants\RestaurantsRepository")
* @UniqueEntity("name")
* @Vich\Uploadable
*/
class Restaurants
{
use IdTrait;
use OrdreTrait;
use DatesTrait;
use SlugTrait;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank(message="Veuillez saisir le nom de votre restaurant")
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="restaurants_image", fileNameProperty="filename")
* @var File|null
* @Assert\Image(
* mimeTypes={"image/jpeg", "image/png"},
*
* maxHeight=1280,
* maxWidth=1920,
* maxHeightMessage="Votre image doit faire 1280 d'hauteur",
* maxWidthMessage="Votre image doit faire 1920 de largeur"
* )
*/
private $imageFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $filename;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="restaurants_image", fileNameProperty="bandeaufile")
* @var File|null
* @Assert\Image(
* mimeTypes={"image/jpeg", "image/png"},
*
* maxHeight=710,
* maxWidth=1920,
* maxHeightMessage="Votre image doit faire 710 d'hauteur",
* maxWidthMessage="Votre image doit faire 1920 de largeur"
* )
*/
private $bandeauImageFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bandeaufile;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contacts;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank(message="Veuillez saisir un email")
* @Assert\Email(message="Veuillez saisir un email valide")
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $siteweb;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $facebook;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $twitter;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $instagram;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ambiance;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $joursouvrables;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="restaurants")
*/
private $user;
/**
* @ORM\Column(type="boolean", options={"default": 0})
*/
private $online;
/**
* @ORM\Column(type="boolean", options={"default": 0})
*/
private $activated;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Restaurants\Specialites", inversedBy="restaurants")
*/
private $specialites;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Restaurants\Servicesrestaurants", inversedBy="restaurants")
*/
private $services;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Restaurants\Mediasrestaurants", mappedBy="restaurants")
*/
private $mediasrestaurants;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $othersspecialites;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $othersservices;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $longitude;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $latitude;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Localizations\Cities", inversedBy="restaurants")
*/
private $cities;
/**
* @ORM\Column(type="boolean")
*/
private $featured;
public function __construct()
{
$this->specialites = new ArrayCollection();
$this->services = new ArrayCollection();
$this->mediasrestaurants = new ArrayCollection();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return File|null
*/
public function getImageFile(): ?File
{
return $this->imageFile;
}
/**
* @param File|null $imageFile
* @return Restaurants
* @throws Exception
*/
public function setImageFile(?File $imageFile): Restaurants
{
$this->imageFile = $imageFile;
if ($this->imageFile instanceof UploadedFile) {
// 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('now');
}
return $this;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(?string $filename): self
{
$this->filename = $filename;
return $this;
}
/**
* @return File|null
*/
public function getBandeauImageFile(): ?File
{
return $this->bandeauImageFile;
}
/**
* @param File|null $bandeauImageFile
* @return Restaurants
* @throws Exception
*/
public function setBandeauImageFile(?File $bandeauImageFile): Restaurants
{
$this->bandeauImageFile = $bandeauImageFile;
if ($this->bandeauImageFile instanceof UploadedFile) {
// 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('now');
}
return $this;
}
public function getBandeaufile(): ?string
{
return $this->bandeaufile;
}
public function setBandeaufile(?string $bandeaufile): self
{
$this->bandeaufile = $bandeaufile;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getContacts(): ?string
{
return $this->contacts;
}
public function setContacts(?string $contacts): self
{
$this->contacts = $contacts;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getSiteweb(): ?string
{
return $this->siteweb;
}
public function setSiteweb(?string $siteweb): self
{
$this->siteweb = $siteweb;
return $this;
}
public function getFacebook(): ?string
{
return $this->facebook;
}
public function setFacebook(?string $facebook): self
{
$this->facebook = $facebook;
return $this;
}
public function getTwitter(): ?string
{
return $this->twitter;
}
public function setTwitter(?string $twitter): self
{
$this->twitter = $twitter;
return $this;
}
public function getInstagram(): ?string
{
return $this->instagram;
}
public function setInstagram(?string $instagram): self
{
$this->instagram = $instagram;
return $this;
}
public function getAmbiance(): ?string
{
return $this->ambiance;
}
public function setAmbiance(?string $ambiance): self
{
$this->ambiance = $ambiance;
return $this;
}
public function getJoursouvrables(): ?string
{
return $this->joursouvrables;
}
public function setJoursouvrables(?string $joursouvrables): self
{
$this->joursouvrables = $joursouvrables;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getOnline(): ?bool
{
return $this->online;
}
public function setOnline(bool $online): self
{
$this->online = $online;
return $this;
}
public function getActivated(): ?bool
{
return $this->activated;
}
public function setActivated(bool $activated): self
{
$this->activated = $activated;
return $this;
}
/**
* @return Collection|Specialites[]
*/
public function getSpecialites(): Collection
{
return $this->specialites;
}
public function addSpecialite(Specialites $specialite): self
{
if (!$this->specialites->contains($specialite)) {
$this->specialites[] = $specialite;
}
return $this;
}
public function removeSpecialite(Specialites $specialite): self
{
if ($this->specialites->contains($specialite)) {
$this->specialites->removeElement($specialite);
}
return $this;
}
/**
* @return Collection|Servicesrestaurants[]
*/
public function getServices(): Collection
{
return $this->services;
}
public function addService(Servicesrestaurants $service): self
{
if (!$this->services->contains($service)) {
$this->services[] = $service;
}
return $this;
}
public function removeService(Servicesrestaurants $service): self
{
if ($this->services->contains($service)) {
$this->services->removeElement($service);
}
return $this;
}
/**
* @return Collection|Mediasrestaurants[]
*/
public function getMediasrestaurants(): Collection
{
return $this->mediasrestaurants;
}
public function addMediasrestaurant(Mediasrestaurants $mediasrestaurant): self
{
if (!$this->mediasrestaurants->contains($mediasrestaurant)) {
$this->mediasrestaurants[] = $mediasrestaurant;
$mediasrestaurant->setRestaurants($this);
}
return $this;
}
public function removeMediasrestaurant(Mediasrestaurants $mediasrestaurant): self
{
if ($this->mediasrestaurants->contains($mediasrestaurant)) {
$this->mediasrestaurants->removeElement($mediasrestaurant);
// set the owning side to null (unless already changed)
if ($mediasrestaurant->getRestaurants() === $this) {
$mediasrestaurant->setRestaurants(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
public function getOthersspecialites(): ?string
{
return $this->othersspecialites;
}
public function setOthersspecialites(?string $othersspecialites): self
{
$this->othersspecialites = $othersspecialites;
return $this;
}
public function getOthersservices(): ?string
{
return $this->othersservices;
}
public function setOthersservices(?string $othersservices): self
{
$this->othersservices = $othersservices;
return $this;
}
public function getLongitude(): ?string
{
return $this->longitude;
}
public function setLongitude(?string $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getLatitude(): ?string
{
return $this->latitude;
}
public function setLatitude(?string $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getCities(): ?Cities
{
return $this->cities;
}
public function setCities(?Cities $cities): self
{
$this->cities = $cities;
return $this;
}
public function getFeatured(): ?bool
{
return $this->featured;
}
public function setFeatured(bool $featured): self
{
$this->featured = $featured;
return $this;
}
}