<?php
namespace App\Entity\Hotels;
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\Typechambres;
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\Hotels\HotelsRepository")
* @UniqueEntity("name")
* @Vich\Uploadable
*/
class Hotels
{
use IdTrait;
use OrdreTrait;
use DatesTrait;
use SlugTrait;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotBlank(message="Veuillez saisir le nom de votre hôtel")
*/
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="hotels_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;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="integer", options={"default": 0})
* @Assert\NotBlank(message="Veuillez saisir le nombre d'étoile")
*/
private $standing;
/**
* @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 $contacts;
/**
* @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 $instagram;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $twitter;
/**
* @ORM\Column(type="integer", options={"default": 0})
* @Assert\NotBlank(message="Veuillez saisir le nombre total de chambre svp!")
*/
private $totalchambres;
/**
* @ORM\Column(type="boolean", options={"default": 0})
*/
private $online;
/**
* @ORM\Column(type="boolean", options={"default": 0})
*/
private $activated;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="hotels")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Hotels\Mediashotels", mappedBy="hotels")
*/
private $mediashotels;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Hotels\Annonceshotels", mappedBy="hotels")
*/
private $annonceshotels;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Hotels\Commodites", inversedBy="hotels")
*/
private $commodites;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $longitude;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $latitude;
/**
* @ORM\Column(type="string", length=500, nullable=true)
*/
private $otherscommodites;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $superficie;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="hotels_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\ManyToOne(targetEntity="App\Entity\Localizations\Cities", inversedBy="hotels")
*/
private $cities;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Typechambres", inversedBy="hotels")
*/
private $typechambres;
/**
* @ORM\Column(type="boolean")
*/
private $featured;
public function __construct()
{
$this->commodites = new ArrayCollection();
$this->typechambres = 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 Hotels
* @throws Exception
*/
public function setImageFile(?File $imageFile): Hotels
{
$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;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getStanding(): ?int
{
return $this->standing;
}
public function setStanding(int $standing): self
{
$this->standing = $standing;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getContacts(): ?string
{
return $this->contacts;
}
public function setContacts(?string $contacts): self
{
$this->contacts = $contacts;
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 getInstagram(): ?string
{
return $this->instagram;
}
public function setInstagram(?string $instagram): self
{
$this->instagram = $instagram;
return $this;
}
public function getTwitter(): ?string
{
return $this->twitter;
}
public function setTwitter(?string $twitter): self
{
$this->twitter = $twitter;
return $this;
}
public function getTotalchambres(): ?int
{
return $this->totalchambres;
}
public function setTotalchambres(int $totalchambres): self
{
$this->totalchambres = $totalchambres;
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;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection|Mediashotels[]
*/
public function getMediashotels(): Collection
{
return $this->mediashotels;
}
public function addMediashotel(Mediashotels $mediashotels): self
{
if (!$this->mediashotels->contains($mediashotels)) {
$this->mediashotels[] = $mediashotels;
$mediashotels->setHotels($this);
}
return $this;
}
public function removeMediashotel(Mediashotels $mediashotels): self
{
if ($this->mediashotels->contains($mediashotels)) {
$this->mediashotels->removeElement($mediashotels);
// set the owning side to null (unless already changed)
if ($mediashotels->getHotels() === $this) {
$mediashotels->setHotels(null);
}
}
return $this;
}
/**
* @return Collection|Annonceshotels[]
*/
public function getAnnonceshotels(): Collection
{
return $this->annonceshotels;
}
public function addAnnonceshotel(Annonceshotels $annonceshotels): self
{
if (!$this->annonceshotels->contains($annonceshotels)) {
$this->annonceshotels[] = $annonceshotels;
$annonceshotels->setHotels($this);
}
return $this;
}
public function removeAnnonceshotel(Annonceshotels $annonceshotels): self
{
if ($this->annonceshotels->contains($annonceshotels)) {
$this->annonceshotels->removeElement($annonceshotels);
// set the owning side to null (unless already changed)
if ($annonceshotels->getHotels() === $this) {
$annonceshotels->setHotels(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection|Commodites[]
*/
public function getCommodites(): Collection
{
return $this->commodites;
}
public function addCommodite(Commodites $commodite): self
{
if (!$this->commodites->contains($commodite)) {
$this->commodites[] = $commodite;
$commodite->addHotel($this);
}
return $this;
}
public function removeCommodite(Commodites $commodite): self
{
if ($this->commodites->contains($commodite)) {
$this->commodites->removeElement($commodite);
$commodite->removeHotel($this);
}
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 getOtherscommodites(): ?string
{
return $this->otherscommodites;
}
public function setOtherscommodites(?string $otherscommodites): self
{
$this->otherscommodites = $otherscommodites;
return $this;
}
public function getSuperficie(): ?string
{
return $this->superficie;
}
public function setSuperficie(?string $superficie): self
{
$this->superficie = $superficie;
return $this;
}
/**
* @return File|null
*/
public function getBandeauImageFile(): ?File
{
return $this->bandeauImageFile;
}
/**
* @param File|null $bandeauImageFile
* @return Hotels
* @throws Exception
*/
public function setBandeauImageFile(?File $bandeauImageFile): Hotels
{
$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 getCities(): ?Cities
{
return $this->cities;
}
public function setCities(?Cities $cities): self
{
$this->cities = $cities;
return $this;
}
/**
* @return Collection|Typechambres[]
*/
public function getTypechambres(): Collection
{
return $this->typechambres;
}
public function addTypechambre(Typechambres $typechambre): self
{
if (!$this->typechambres->contains($typechambre)) {
$this->typechambres[] = $typechambre;
}
return $this;
}
public function removeTypechambre(Typechambres $typechambre): self
{
if ($this->typechambres->contains($typechambre)) {
$this->typechambres->removeElement($typechambre);
}
return $this;
}
public function getFeatured(): ?bool
{
return $this->featured;
}
public function setFeatured(bool $featured): self
{
$this->featured = $featured;
return $this;
}
}