<?phpnamespace App\Entity;use App\Repository\ServiceRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ServiceRepository::class)]class Service{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $typeService = null; #[ORM\ManyToMany(targetEntity: JobCard::class, mappedBy: 'services')] private Collection $jobCards; #[ORM\OneToMany(mappedBy: 'service', targetEntity: Traveaux::class)] private Collection $traveauxes; #[ORM\Column(nullable: true)] private ?\DateTimeImmutable $createdAt = null; #[ORM\Column(nullable: true)] private ?\DateTimeImmutable $updatedAt = null; public function __construct() { $this->jobCards = new ArrayCollection(); $this->traveauxes = new ArrayCollection(); $this->createdAt = new \DateTimeImmutable(); $this->updatedAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getTypeService(): ?string { return $this->typeService; } public function setTypeService(string $typeService): static { $this->typeService = $typeService; return $this; } /** * @return Collection<int, JobCard> */ public function getJobCards(): Collection { return $this->jobCards; } public function addJobCard(JobCard $jobCard): static { if (!$this->jobCards->contains($jobCard)) { $this->jobCards->add($jobCard); $jobCard->addService($this); } return $this; } public function removeJobCard(JobCard $jobCard): static { if ($this->jobCards->removeElement($jobCard)) { $jobCard->removeService($this); } return $this; } /** * @return Collection<int, Traveaux> */ public function getTraveauxes(): Collection { return $this->traveauxes; } public function addTraveaux(Traveaux $traveaux): static { if (!$this->traveauxes->contains($traveaux)) { $this->traveauxes->add($traveaux); $traveaux->setService($this); } return $this; } public function removeTraveaux(Traveaux $traveaux): static { if ($this->traveauxes->removeElement($traveaux)) { // set the owning side to null (unless already changed) if ($traveaux->getService() === $this) { $traveaux->setService(null); } } return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(?\DateTimeImmutable $createdAt): static { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeImmutable $updatedAt): static { $this->updatedAt = $updatedAt; return $this; }}