src/Entity/Vetoadom/SecteurCliniqueSecondaire.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Vetoadom;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7.  * SecteurCliniqueSecondaire
  8.  *
  9.  * @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"})})
  10.  * @ORM\Entity(repositoryClass="App\Repository\Vetoadom\SecteurCliniqueSecondaireRepository")
  11.  * @ORM\HasLifecycleCallbacks()
  12.  * @UniqueEntity(
  13.  *      groups={"nom"},
  14.  *      fields={"nom","secteur"},
  15.  *      errorPath="nom",
  16.  *      message="page_admin_params_secteur_section_localisation_cliniques_secondaires.nom_exist"
  17.  *   )
  18.  */
  19. class SecteurCliniqueSecondaire
  20. {
  21.     /**
  22.      * @var int
  23.      *
  24.      * @ORM\Column(name="id", type="integer", nullable=false)
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="IDENTITY")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @var string
  31.      *
  32.      * @ORM\Column(name="nom", type="string", length=80, nullable=false)
  33.      * @Assert\NotBlank(
  34.      *       groups={"nom"},
  35.      *       message="common.blank"
  36.      *    )
  37.      * @Assert\Length(
  38.      *       groups={"nom"},
  39.      *       max=80,
  40.      *       maxMessage="common.too_long"
  41.      *    )
  42.      */
  43.     private $nom;
  44.     /**
  45.      * @var string
  46.      *
  47.      * @ORM\Column(name="adresse1", type="string", length=38, nullable=false)
  48.      * @Assert\NotBlank(
  49.      *      groups={"adresse1"},
  50.      *      message="common.blank"
  51.      *   )
  52.      * @Assert\Length(
  53.      *       groups={"adresse1"},
  54.      *       max=38,
  55.      *       maxMessage="common.too_long"
  56.      *    )
  57.      */
  58.     private $adresse1;
  59.     /**
  60.      * @var string|null
  61.      *
  62.      * @ORM\Column(name="adresse2", type="string", length=38, nullable=true)
  63.      * @Assert\Length(
  64.      *        groups={"adresse2"},
  65.      *        max=38,
  66.      *        maxMessage="common.too_long"
  67.      *     )
  68.      */
  69.     private $adresse2;
  70.     /**
  71.      * @var bool
  72.      *
  73.      * @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"})
  74.      */
  75.     private $active true;
  76.     /**
  77.      * @var \DateTime
  78.      *
  79.      * @ORM\Column(name="date_creation", type="datetime", nullable=false)
  80.      */
  81.     private $dateCreation;
  82.     /**
  83.      * @var \DateTime
  84.      *
  85.      * @ORM\Column(name="date_modification", type="datetime", nullable=false, options={"default"="CURRENT_TIMESTAMP"})
  86.      */
  87.     private $dateModification;
  88.     /**
  89.      * @var \Secteur
  90.      *
  91.      * @ORM\ManyToOne(targetEntity="Secteur", inversedBy="secteurCliniqueSecondaire")
  92.      * @ORM\JoinColumns({
  93.      *   @ORM\JoinColumn(name="secteur_id", referencedColumnName="id")
  94.      * })
  95.      */
  96.     private $secteur;
  97.     /**
  98.      * @var \Ville
  99.      *
  100.      * @ORM\ManyToOne(targetEntity="Ville")
  101.      * @ORM\JoinColumns({
  102.      *   @ORM\JoinColumn(name="ville_id", referencedColumnName="id")
  103.      * })
  104.      * @Assert\NotBlank(
  105.      *       groups={"ville"},
  106.      *       message="common.blank"
  107.      *    )
  108.      */
  109.     private $ville;
  110.     public function getId(): ?int
  111.     {
  112.         return $this->id;
  113.     }
  114.     public function getNom(): ?string
  115.     {
  116.         return $this->nom;
  117.     }
  118.     public function setNom(string $nom): self
  119.     {
  120.         $this->nom $nom;
  121.         return $this;
  122.     }
  123.     public function getAdresse1(): ?string
  124.     {
  125.         return $this->adresse1;
  126.     }
  127.     public function setAdresse1(string $adresse1): self
  128.     {
  129.         $this->adresse1 $adresse1;
  130.         return $this;
  131.     }
  132.     public function getAdresse2(): ?string
  133.     {
  134.         return $this->adresse2;
  135.     }
  136.     public function setAdresse2(?string $adresse2): self
  137.     {
  138.         if ($adresse2 === ''$adresse2 null;
  139.         $this->adresse2 $adresse2;
  140.         return $this;
  141.     }
  142.     public function getActive(): ?bool
  143.     {
  144.         return $this->active;
  145.     }
  146.     public function setActive(bool $active): self
  147.     {
  148.         $this->active $active;
  149.         return $this;
  150.     }
  151.     public function getDateCreation(): ?\DateTimeInterface
  152.     {
  153.         return $this->dateCreation;
  154.     }
  155.     public function setDateCreation(\DateTimeInterface $dateCreation): self
  156.     {
  157.         $this->dateCreation $dateCreation;
  158.         return $this;
  159.     }
  160.     public function getDateModification(): ?\DateTimeInterface
  161.     {
  162.         return $this->dateModification;
  163.     }
  164.     public function setDateModification(\DateTimeInterface $dateModification): self
  165.     {
  166.         $this->dateModification $dateModification;
  167.         return $this;
  168.     }
  169.     public function getSecteur(): ?Secteur
  170.     {
  171.         return $this->secteur;
  172.     }
  173.     public function setSecteur(?Secteur $secteur): self
  174.     {
  175.         $this->secteur $secteur;
  176.         return $this;
  177.     }
  178.     public function getVille(): ?Ville
  179.     {
  180.         return $this->ville;
  181.     }
  182.     public function setVille(?Ville $ville): self
  183.     {
  184.         $this->ville $ville;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @ORM\PrePersist
  189.      */
  190.     public function setCreatedAtValue()
  191.     {
  192.         $this->dateCreation = new \DateTimeImmutable();
  193.     }
  194. }