<?php
namespace App\Entity\Vetoadom;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* SecteurCliniqueSecondaire
*
* @ORM\Table(name="secteur_clinique_secondaire", uniqueConstraints={@ORM\UniqueConstraint(name="secteur_id_nom", columns={"secteur_id", "nom"})}, indexes={@ORM\Index(name="FK_secteur_clinique_secondaire_ville", columns={"ville_id"}), @ORM\Index(name="IDX_D3F1D2519F7E4405", columns={"secteur_id"})})
* @ORM\Entity(repositoryClass="App\Repository\Vetoadom\SecteurCliniqueSecondaireRepository")
* @ORM\HasLifecycleCallbacks()
* @UniqueEntity(
* groups={"nom"},
* fields={"nom","secteur"},
* errorPath="nom",
* message="page_admin_params_secteur_section_localisation_cliniques_secondaires.nom_exist"
* )
*/
class SecteurCliniqueSecondaire
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="nom", type="string", length=80, nullable=false)
* @Assert\NotBlank(
* groups={"nom"},
* message="common.blank"
* )
* @Assert\Length(
* groups={"nom"},
* max=80,
* maxMessage="common.too_long"
* )
*/
private $nom;
/**
* @var string
*
* @ORM\Column(name="adresse1", type="string", length=38, nullable=false)
* @Assert\NotBlank(
* groups={"adresse1"},
* message="common.blank"
* )
* @Assert\Length(
* groups={"adresse1"},
* max=38,
* maxMessage="common.too_long"
* )
*/
private $adresse1;
/**
* @var string|null
*
* @ORM\Column(name="adresse2", type="string", length=38, nullable=true)
* @Assert\Length(
* groups={"adresse2"},
* max=38,
* maxMessage="common.too_long"
* )
*/
private $adresse2;
/**
* @var bool
*
* @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"})
*/
private $active = true;
/**
* @var \DateTime
*
* @ORM\Column(name="date_creation", type="datetime", nullable=false)
*/
private $dateCreation;
/**
* @var \DateTime
*
* @ORM\Column(name="date_modification", type="datetime", nullable=false, options={"default"="CURRENT_TIMESTAMP"})
*/
private $dateModification;
/**
* @var \Secteur
*
* @ORM\ManyToOne(targetEntity="Secteur", inversedBy="secteurCliniqueSecondaire")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="secteur_id", referencedColumnName="id")
* })
*/
private $secteur;
/**
* @var \Ville
*
* @ORM\ManyToOne(targetEntity="Ville")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="ville_id", referencedColumnName="id")
* })
* @Assert\NotBlank(
* groups={"ville"},
* message="common.blank"
* )
*/
private $ville;
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getAdresse1(): ?string
{
return $this->adresse1;
}
public function setAdresse1(string $adresse1): self
{
$this->adresse1 = $adresse1;
return $this;
}
public function getAdresse2(): ?string
{
return $this->adresse2;
}
public function setAdresse2(?string $adresse2): self
{
if ($adresse2 === '') $adresse2 = null;
$this->adresse2 = $adresse2;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
public function getDateCreation(): ?\DateTimeInterface
{
return $this->dateCreation;
}
public function setDateCreation(\DateTimeInterface $dateCreation): self
{
$this->dateCreation = $dateCreation;
return $this;
}
public function getDateModification(): ?\DateTimeInterface
{
return $this->dateModification;
}
public function setDateModification(\DateTimeInterface $dateModification): self
{
$this->dateModification = $dateModification;
return $this;
}
public function getSecteur(): ?Secteur
{
return $this->secteur;
}
public function setSecteur(?Secteur $secteur): self
{
$this->secteur = $secteur;
return $this;
}
public function getVille(): ?Ville
{
return $this->ville;
}
public function setVille(?Ville $ville): self
{
$this->ville = $ville;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->dateCreation = new \DateTimeImmutable();
}
}