src/Entity/Service.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ServiceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassServiceRepository::class)]
  8. class Service
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $typeService null;
  16.     #[ORM\ManyToMany(targetEntityJobCard::class, mappedBy'services')]
  17.     private Collection $jobCards;
  18.     #[ORM\OneToMany(mappedBy'service'targetEntityTraveaux::class)]
  19.     private Collection $traveauxes;
  20.     #[ORM\Column(nullabletrue)]
  21.     private ?\DateTimeImmutable $createdAt null;
  22.     #[ORM\Column(nullabletrue)]
  23.     private ?\DateTimeImmutable $updatedAt null;
  24.     public function __construct()
  25.     {
  26.         $this->jobCards = new ArrayCollection();
  27.         $this->traveauxes = new ArrayCollection();
  28.         $this->createdAt = new \DateTimeImmutable();
  29.         $this->updatedAt = new \DateTimeImmutable();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getTypeService(): ?string
  36.     {
  37.         return $this->typeService;
  38.     }
  39.     public function setTypeService(string $typeService): static
  40.     {
  41.         $this->typeService $typeService;
  42.         return $this;
  43.     }
  44.     /**
  45.      * @return Collection<int, JobCard>
  46.      */
  47.     public function getJobCards(): Collection
  48.     {
  49.         return $this->jobCards;
  50.     }
  51.     public function addJobCard(JobCard $jobCard): static
  52.     {
  53.         if (!$this->jobCards->contains($jobCard)) {
  54.             $this->jobCards->add($jobCard);
  55.             $jobCard->addService($this);
  56.         }
  57.         return $this;
  58.     }
  59.     public function removeJobCard(JobCard $jobCard): static
  60.     {
  61.         if ($this->jobCards->removeElement($jobCard)) {
  62.             $jobCard->removeService($this);
  63.         }
  64.         return $this;
  65.     }
  66.     /**
  67.      * @return Collection<int, Traveaux>
  68.      */
  69.     public function getTraveauxes(): Collection
  70.     {
  71.         return $this->traveauxes;
  72.     }
  73.     public function addTraveaux(Traveaux $traveaux): static
  74.     {
  75.         if (!$this->traveauxes->contains($traveaux)) {
  76.             $this->traveauxes->add($traveaux);
  77.             $traveaux->setService($this);
  78.         }
  79.         return $this;
  80.     }
  81.     public function removeTraveaux(Traveaux $traveaux): static
  82.     {
  83.         if ($this->traveauxes->removeElement($traveaux)) {
  84.             // set the owning side to null (unless already changed)
  85.             if ($traveaux->getService() === $this) {
  86.                 $traveaux->setService(null);
  87.             }
  88.         }
  89.         return $this;
  90.     }
  91.     public function getCreatedAt(): ?\DateTimeImmutable
  92.     {
  93.         return $this->createdAt;
  94.     }
  95.     public function setCreatedAt(?\DateTimeImmutable $createdAt): static
  96.     {
  97.         $this->createdAt $createdAt;
  98.         return $this;
  99.     }
  100.     public function getUpdatedAt(): ?\DateTimeImmutable
  101.     {
  102.         return $this->updatedAt;
  103.     }
  104.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): static
  105.     {
  106.         $this->updatedAt $updatedAt;
  107.         return $this;
  108.     }
  109. }