<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Site\Logistique;
use Gedmo\Timestampable\Traits\Timestampable;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\HttpFoundation\File\File;
/**
* Site
*
* @ORM\Table(name="site", indexes={@ORM\Index(name="IDX_694309E4F5B7AF75", columns={"address_id"})})
* @ORM\Entity
*/
class Site
{
const TYPE_EHPAD = 'ehpad';
const TYPE_CLINIQUE = 'clinique';
const TYPE_RESIDENCE = 'residence';
const TYPE_SSR = 'ssr';
const TYPE_HOPITAL = 'hopital';
const ZONE_GIRONDE = 'Gironde';
const ZONE_NORMANDIE = 'Normandie';
const ZONE_IDF = 'IDF';
const ZONE_PACA = 'PACA';
const ZONE_CA = 'Champagne-Ardenne';
const ZONE_CM = 'Charente-Maritime';
const ZONE_LANDES = 'Les Landes';
const ZONE_NA = 'Nouvelle-Aquitaine';
const ZONE_OCCITANIE = 'Occitanie';
const STATUS_PROSPECT = 'prospect';
const STATUS_ACTIF = 'actif';
const STATUS_CLOSE = 'closed';
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="type", type="string", nullable=true)
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="enseigne", type="string", nullable=true)
*/
private $enseigne;
/**
* @ORM\Column(name="phone", type="string", nullable=true)
*/
private $phone;
/**
* @var string
*
* @ORM\Column(name="status", type="string", length=500, nullable=true)
*/
private $status;
/**
* @var string
*
* @ORM\Column(name="zoneGeographique", type="string", nullable=true)
*/
private $zoneGeographique;
/**
* @var string
*
* @ORM\Column(name="consignesLingeries", type="text", nullable=true)
*/
private $consignesLingeries;
/**
* @var string
*
* @ORM\Column(name="parking", type="text", nullable=true)
*/
private $parking;
/**
* @var string
*
* @ORM\Column(name="rangementCles", type="text", nullable=true)
*/
private $rangementCles;
/**
* @var string
*
* @ORM\Column(name="localPoubelles", type="text", nullable=true)
*/
private $localPoubelles;
/**
* @var string
*
* @ORM\Column(name="codeAccess", type="text", nullable=true)
*/
private $codeAccess;
protected File $file;
/**
* @var string
*
* @ORM\Column(name="filename", type="text", nullable=true)
*/
private $filename;
/**
* @var string
*
* @ORM\Column(name="autresInformations", type="text", nullable=true)
*/
private $autresInformations;
/**
* @var string
*
* @ORM\Column(name="emailSite", type="string", nullable=true)
*/
private $emailSite;
/**
* @ORM\OneToOne(targetEntity=Logistique::class, inversedBy="site" , cascade={"persist"})
* @ORM\JoinColumn(name="logistique_id", referencedColumnName="id")
*/
protected $logistique;
/**
* @var Salon ArrayCollection
* @ORM\OneToMany(targetEntity="Salon", mappedBy="site")
*/
protected $salons;
/**
* @var Contact ArrayCollection
* @ORM\OneToMany(targetEntity="Contact", mappedBy="site", cascade={"persist"})
*/
protected $othersContacts;
/**
* @var Address|null
*
* @ORM\ManyToOne(targetEntity="Address", cascade={"persist"})
* @ORM\JoinColumn(name="address_id", referencedColumnName="id")
*/
private $address;
/**
* @var Contact|null
*
* @ORM\ManyToOne(targetEntity="Contact", cascade={"persist"})
* @ORM\JoinColumn(name="contactCommercial_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $contactCommercial;
/**
* @var Contact|null
*
* @ORM\ManyToOne(targetEntity="Contact", cascade={"persist"})
* @ORM\JoinColumn(name="contactBilling_id", referencedColumnName="id" , onDelete="SET NULL")
*/
private $contactBilling;
/**
* @var Contact|null
*
* @ORM\ManyToOne(targetEntity="Contact", cascade={"persist"})
* @ORM\JoinColumn(name="contact_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $contact;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $noDisplayReservation = false;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $noDisplayAnnuaire = false;
/**
* @var \DateTime $created
*
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
*/
private $created;
/**
* @var \DateTime $updated
*
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
*/
private $updated;
/**
* @ORM\ManyToOne(targetEntity=User::class, cascade={"persist"})
* @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
*/
protected $creator;
/**
* @ORM\ManyToOne(targetEntity=User::class, cascade={"persist"})
* @ORM\JoinColumn(name="maj_id", referencedColumnName="id")
*/
protected $maj;
public function __toString(): string
{
return $this->name;
}
public function __construct()
{
$this->salons = new ArrayCollection();
$this->othersContacts = new ArrayCollection();
}
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 getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(?Address $address): self
{
$this->address = $address;
return $this;
}
/**
* @return string
*/
public function getType(): ?string
{
return $this->type;
}
/**
* @param string $type
*/
public function setType(string $type): void
{
$this->type = $type;
}
/**
* @return Contact|null
*/
public function getContactCommercial(): ?Contact
{
return $this->contactCommercial;
}
/**
* @param Contact|null $contactCommercial
*/
public function setContactCommercial(?Contact $contactCommercial): void
{
$this->contactCommercial = $contactCommercial;
}
/**
* @return Contact|null
*/
public function getContactBilling(): ?Contact
{
return $this->contactBilling;
}
/**
* @param Contact|null $contactBilling
*/
public function setContactBilling(?Contact $contactBilling): void
{
$this->contactBilling = $contactBilling;
}
/**
* @return Contact|null
*/
public function getContact(): ?Contact
{
return $this->contact;
}
/**
* @param Contact|null $contact
*/
public function setContact(?Contact $contact): void
{
$this->contact = $contact;
}
/**
* @return []
*/
public function getSalons()
{
return $this->salons;
}
/**
* @return []
*/
public function getFirstSalonsByTag($tag)
{
$criteria = Criteria::create()
->andWhere(Criteria::expr()->eq('service', $tag));
return $this->salons->matching($criteria);
}
/**
* @param Salon $salons
*/
public function setSalons(Salon $salons): void
{
$this->salons = $salons;
}
public function getStatusLibelle()
{
switch ($this->name) {
case 1:
return $this::STATUS_ACTIF;
case 0:
return $this::STATUS_CLOSE;
}
}
/**
* @return string
*/
public function getZoneGeographique()
{
return $this->zoneGeographique;
}
/**
* @param string $zoneGeographique
*/
public function setZoneGeographique(string $zoneGeographique): void
{
$this->zoneGeographique = $zoneGeographique;
}
/**
* @return ArrayCollection
*/
public function getOthersContacts()
{
return $this->othersContacts;
}
/**
* @param $othersContacts
*/
public function setOthersContacts($othersContacts): void
{
$this->othersContacts = $othersContacts;
}
/**
* @return string
*/
public function getEnseigne(): ?string
{
return $this->enseigne;
}
/**
* @param string $enseigne
*/
public function setEnseigne(string $enseigne): void
{
$this->enseigne = $enseigne;
}
/**
* @return Logistique|mixed
*/
public function getLogistique()
{
return $this->logistique;
}
/**
* @param mixed $logistique
*/
public function setLogistique($logistique): void
{
$this->logistique = $logistique;
}
/**
* @return string
*/
public function getEmailSite(): ?string
{
return $this->emailSite;
}
/**
* @param string $emailSite
*/
public function setEmailSite(string $emailSite): void
{
$this->emailSite = $emailSite;
}
/*********/
/* ADD */
/********/
public function addOthersContact(Contact $item)
{
$this->othersContacts->add($item);
$item->setSite($this);
}
/*********/
/* REMVOE */
/********/
public function removeOthersContact(Contact $item)
{
$this->othersContacts->remove($item);
}
public static function getSiteZones()
{
return [
Site::ZONE_GIRONDE => 'Gironde',
Site::ZONE_NORMANDIE => 'Normandie',
Site::ZONE_IDF => 'IDF',
Site::ZONE_PACA => 'PACA',
Site::ZONE_CA => 'Champagne-Ardenne',
Site::ZONE_CM => 'Charente-Maritime',
Site::ZONE_LANDES => 'Les Landes',
Site::ZONE_NA => 'Nouvelle-Aquitaine',
Site::ZONE_OCCITANIE => 'Occitanie',
];
}
public static function getSiteTypes()
{
return [
Site::TYPE_SSR => 'CLINIQUE SSR',
Site::TYPE_EHPAD => 'EHPAD',
Site::TYPE_HOPITAL => 'HOPITAL',
Site::TYPE_RESIDENCE => 'RESIDENCE',
];
}
public function isNoDisplayReservation(): ?bool
{
return $this->noDisplayReservation;
}
public function setNoDisplayReservation(?bool $noDisplayReservation): self
{
$this->noDisplayReservation = $noDisplayReservation;
return $this;
}
/**
* @return string
*/
public function getConsignesLingeries(): ?string
{
return $this->consignesLingeries;
}
/**
* @param string $consignesLingeries
*/
public function setConsignesLingeries(?string $consignesLingeries): void
{
$this->consignesLingeries = $consignesLingeries;
}
/**
* @return string
*/
public function getParking(): ?string
{
return $this->parking;
}
/**
* @param string $parking
*/
public function setParking(?string $parking): void
{
$this->parking = $parking;
}
/**
* @return string
*/
public function getRangementCles(): ?string
{
return $this->rangementCles;
}
/**
* @param string $rangementCles
*/
public function setRangementCles(?string $rangementCles): void
{
$this->rangementCles = $rangementCles;
}
/**
* @return string
*/
public function getLocalPoubelles(): ?string
{
return $this->localPoubelles;
}
/**
* @param string $localPoubelles
*/
public function setLocalPoubelles(?string $localPoubelles): void
{
$this->localPoubelles = $localPoubelles;
}
/**
* @return string
*/
public function getCodeAccess(): ?string
{
return $this->codeAccess;
}
/**
* @param string $codeAccess
*/
public function setCodeAccess(?string $codeAccess): void
{
$this->codeAccess = $codeAccess;
}
/**
* @return string
*/
public function getAutresInformations(): ?string
{
return $this->autresInformations;
}
/**
* @param string $autresInformations
*/
public function setAutresInformations(?string $autresInformations): void
{
$this->autresInformations = $autresInformations;
}
/**
* @return bool
*/
public function isNoDisplayAnnuaire(): ?bool
{
return $this->noDisplayAnnuaire;
}
/**
* @param bool $noDisplayAnnuaire
*/
public function setNoDisplayAnnuaire(?bool $noDisplayAnnuaire): void
{
$this->noDisplayAnnuaire = $noDisplayAnnuaire;
}
/**
* @return mixed
*/
public function getCreator()
{
return $this->creator;
}
/**
* @param mixed $creator
*/
public function setCreator($creator): void
{
$this->creator = $creator;
}
/**
* @return mixed
*/
public function getMaj()
{
return $this->maj;
}
/**
* @param mixed $maj
*/
public function setMaj($maj): void
{
$this->maj = $maj;
}
/**
* @return \DateTime
*/
public function getCreated(): \DateTime
{
return $this->created;
}
/**
* @param \DateTime $created
*/
public function setCreated(\DateTime $created): void
{
$this->created = $created;
}
/**
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* @param \DateTime $updated
*/
public function setUpdated(\DateTime $updated): void
{
$this->updated = $updated;
}
/**
* @return mixed
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param mixed $phone
*/
public function setPhone($phone): void
{
$this->phone = $phone;
}
/**
* @return File
*/
public function getFile(): ?File
{
return $this->file;
}
/**
* @param File $file
*/
public function setFile(File $file): void
{
$this->file = $file;
}
/**
* @return string
*/
public function getFilename(): ?string
{
return $this->filename;
}
/**
* @param string $filename
*/
public function setFilename(?string $filename): void
{
$this->filename = $filename;
}
}