src/Entity/Planning.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PlanningRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassPlanningRepository::class)]
  10. class Planning
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $title null;
  18.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  19.     private ?string $description null;
  20.     #[ORM\Column(nullabletrue)]
  21.     private ?DateTimeImmutable $startedAt null;
  22.     #[ORM\Column(nullabletrue)]
  23.     private ?DateTimeImmutable $endedAt null;
  24.     #[ORM\ManyToOne(inversedBy'plannings')]
  25.     private ?Establishment $establishment null;
  26.     #[ORM\Column(length255)]
  27.     private ?string $type null;
  28.     #[ORM\ManyToOne(inversedBy'createdPlannings')]
  29.     private ?User $author null;
  30.     #[ORM\ManyToMany(targetEntityDepartment::class, inversedBy'plannings')]
  31.     private Collection $departments;
  32.     #[ORM\ManyToMany(targetEntityUser::class, inversedBy'plannings')]
  33.     private Collection $users;
  34.     public function __construct()
  35.     {
  36.         $this->departments = new ArrayCollection();
  37.         $this->users = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getDescription(): ?string
  44.     {
  45.         return $this->description;
  46.     }
  47.     public function setDescription(?string $description): self
  48.     {
  49.         $this->description $description;
  50.         return $this;
  51.     }
  52.     public function getTitle(): ?string
  53.     {
  54.         return $this->title;
  55.     }
  56.     public function setTitle(string $title): self
  57.     {
  58.         $this->title $title;
  59.         return $this;
  60.     }
  61.     public function getStartedAt(): ?DateTimeImmutable
  62.     {
  63.         return $this->startedAt;
  64.     }
  65.     public function setStartedAt(?DateTimeImmutable $startedAt): self
  66.     {
  67.         $this->startedAt $startedAt;
  68.         return $this;
  69.     }
  70.     public function getEndedAt(): ?DateTimeImmutable
  71.     {
  72.         return $this->endedAt;
  73.     }
  74.     public function setEndedAt(?DateTimeImmutable $endedAt): self
  75.     {
  76.         $this->endedAt $endedAt;
  77.         return $this;
  78.     }
  79.     public function getEstablishment(): ?Establishment
  80.     {
  81.         return $this->establishment;
  82.     }
  83.     public function setEstablishment(?Establishment $establishment): self
  84.     {
  85.         $this->establishment $establishment;
  86.         return $this;
  87.     }
  88.     public function getType(): ?string
  89.     {
  90.         return $this->type;
  91.     }
  92.     public function setType(string $type): static
  93.     {
  94.         $this->type $type;
  95.         return $this;
  96.     }
  97.     public function getAuthor(): ?User
  98.     {
  99.         return $this->author;
  100.     }
  101.     public function setAuthor(?User $author): static
  102.     {
  103.         $this->author $author;
  104.         return $this;
  105.     }
  106.     /**
  107.      * @return Collection<int, Department>
  108.      */
  109.     public function getDepartments(): Collection
  110.     {
  111.         return $this->departments;
  112.     }
  113.     public function addDepartment(Department $department): static
  114.     {
  115.         if (!$this->departments->contains($department)) {
  116.             $this->departments->add($department);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeDepartment(Department $department): static
  121.     {
  122.         $this->departments->removeElement($department);
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection<int, User>
  127.      */
  128.     public function getUsers(): Collection
  129.     {
  130.         return $this->users;
  131.     }
  132.     public function addUser(User $user): static
  133.     {
  134.         if (!$this->users->contains($user)) {
  135.             $this->users->add($user);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeUser(User $user): static
  140.     {
  141.         $this->users->removeElement($user);
  142.         return $this;
  143.     }
  144. }