src/Entity/Domaine.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DomaineRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. #[ORM\Entity(repositoryClassDomaineRepository::class)]
  9. class Domaine
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255nullabletrue)]
  16.     private $code;
  17.     #[ORM\Column(type'string'length255)]
  18.     private $nom;
  19.     #[Gedmo\Timestampable(on'create')]
  20.     #[ORM\Column(type'datetime')]
  21.     private $created_at;
  22.     #[Gedmo\Timestampable(on'update')]
  23.     #[ORM\Column(type'datetime')]
  24.     private $updated_at;
  25.     #[ORM\Column(type'integer')]
  26.     private $created_by;
  27.     #[ORM\Column(type'integer')]
  28.     private $updated_by;
  29.     #[ORM\ManyToMany(targetEntityGroupe::class, mappedBy'domaine')]
  30.     private $groupes;
  31.     public function __construct()
  32.     {
  33.         $this->groupes = new ArrayCollection();
  34.     }
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getCode(): ?string
  40.     {
  41.         return $this->code;
  42.     }
  43.     public function setCode(?string $code): self
  44.     {
  45.         $this->code $code;
  46.         return $this;
  47.     }
  48.     public function getNom(): ?string
  49.     {
  50.         return $this->nom;
  51.     }
  52.     public function setNom(string $nom): self
  53.     {
  54.         $this->nom $nom;
  55.         return $this;
  56.     }
  57.     public function getCreatedAt(): ?\DateTimeInterface
  58.     {
  59.         return $this->created_at;
  60.     }
  61.     public function setCreatedAt(\DateTimeInterface $created_at): self
  62.     {
  63.         $this->created_at $created_at;
  64.         return $this;
  65.     }
  66.     public function getUpdatedAt(): ?\DateTimeInterface
  67.     {
  68.         return $this->updated_at;
  69.     }
  70.     public function setUpdatedAt(\DateTimeInterface $updated_at): self
  71.     {
  72.         $this->updated_at $updated_at;
  73.         return $this;
  74.     }
  75.     public function getCreatedBy(): ?int
  76.     {
  77.         return $this->created_by;
  78.     }
  79.     public function setCreatedBy(int $created_by): self
  80.     {
  81.         $this->created_by $created_by;
  82.         return $this;
  83.     }
  84.     public function getUpdatedBy(): ?int
  85.     {
  86.         return $this->updated_by;
  87.     }
  88.     public function setUpdatedBy(int $updated_by): self
  89.     {
  90.         $this->updated_by $updated_by;
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return Collection<int, Groupe>
  95.      */
  96.     public function getGroupes(): Collection
  97.     {
  98.         return $this->groupes;
  99.     }
  100.     public function addGroupe(Groupe $groupe): self
  101.     {
  102.         if (!$this->groupes->contains($groupe)) {
  103.             $this->groupes[] = $groupe;
  104.             $groupe->addDomaine($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeGroupe(Groupe $groupe): self
  109.     {
  110.         if ($this->groupes->removeElement($groupe)) {
  111.             $groupe->removeDomaine($this);
  112.         }
  113.         return $this;
  114.     }
  115. }