← Back
Editing: Service.php
<?php namespace 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 { public const STATUS_SCHEDULED = 'scheduled'; public const STATUS_WAITING = 'waiting'; public const STATUS_DONE = 'done'; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private ?int $id = null; #[ORM\ManyToOne(targetEntity: AgencyPrestataire::class, inversedBy: 'services')] #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] private AgencyPrestataire $providerContact; #[ORM\Column(type: 'datetime', nullable: true)] private ?\DateTimeInterface $confirmDate = null; #[ORM\Column(type: 'boolean')] private bool $done = false; #[ORM\Column(type: 'integer', nullable: true)] private ?int $hours = null; #[ORM\Column(type: 'datetime', nullable: true)] private ?\DateTimeInterface $firstSeenOn = null; #[ORM\Column(type: 'datetime')] private \DateTimeInterface $createdAt; #[ORM\OneToOne(inversedBy: 'service', targetEntity: Controle::class, cascade: ['persist'])] #[ORM\JoinColumn(nullable: true, onDelete: 'CASCADE')] private ?Controle $controle = null; #[ORM\Column(type: 'string', length: 255)] private ?string $hash = null; #[ORM\Column(type: 'text', nullable: true)] private ?string $description = null; #[ORM\Column(type: 'string')] private string $status = self::STATUS_WAITING; #[ORM\OneToMany(mappedBy: 'service', targetEntity: Penalty::class, cascade: ['persist'])] private Collection $penalties; #[ORM\OneToMany(mappedBy: 'service', targetEntity: Message::class)] private Collection $messages; #[ORM\OneToOne(inversedBy: 'service', targetEntity: ElevatorBreakdown::class, cascade: ['persist', 'remove'])] private ?ElevatorBreakdown $elevatorBreakdown = null; #[ORM\OneToOne(mappedBy: 'service', targetEntity: Rebate::class, cascade: ['persist', 'remove'])] private ?Rebate $rebate = null; public function __construct() { $this->createdAt = new \DateTime(); $this->penalties = new ArrayCollection(); $this->messages = new ArrayCollection(); } public function __toString() { return (string) $this->getId(); } public function getId(): ?int { return $this->id; } public function getProviderContact(): AgencyPrestataire { return $this->providerContact; } public function setProviderContact(AgencyPrestataire $providerContact): self { $this->providerContact = $providerContact; return $this; } public function getConfirmDate(): ?\DateTimeInterface { return $this->confirmDate; } public function setConfirmDate(?\DateTimeInterface $confirmDate): self { $this->confirmDate = $confirmDate; return $this; } public function getDone(): ?bool { return $this->done; } public function setDone(bool $done): self { $this->done = $done; return $this; } public function getHours(): ?int { return $this->hours; } public function setHours(?int $hours): self { $this->hours = $hours; return $this; } public function getFirstSeenOn(): ?\DateTimeInterface { return $this->firstSeenOn; } public function setFirstSeenOn(?\DateTimeInterface $firstSeenOn): self { $this->firstSeenOn = $firstSeenOn; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getControle(): ?Controle { return $this->controle; } public function setControle(?Controle $controle): self { $this->controle = $controle; return $this; } public function getHash(): ?string { return $this->hash; } public function setHash(string $hash): self { $this->hash = $hash; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getStatus(): ?string { return $this->status; } public function setStatus(string $status): self { $this->status = $status; return $this; } public function getPenalties(): Collection { return $this->penalties; } public function addPenalty(Penalty $penalty): self { if (!$this->penalties->contains($penalty)) { $this->penalties[] = $penalty; $penalty->setService($this); } return $this; } public function getMessages(): Collection { return $this->messages; } public function addMessage(Message $message): self { if (!$this->messages->contains($message)) { $this->messages[] = $message; $message->setService($this); } return $this; } public function removeMessage(Message $message): self { if ($this->messages->removeElement($message)) { // set the owning side to null (unless already changed) if ($message->getService() === $this) { $message->setService(null); } } return $this; } public function getElevatorBreakdown(): ?ElevatorBreakdown { return $this->elevatorBreakdown; } public function setElevatorBreakdown(?ElevatorBreakdown $elevatorBreakdown): self { $this->elevatorBreakdown = $elevatorBreakdown; return $this; } public function getRebate(): ?Rebate { return $this->rebate; } public function setRebate(?Rebate $rebate): self { // unset the owning side of the relation if necessary if (null === $rebate && null !== $this->rebate) { $this->rebate->setService(null); } // set the owning side of the relation if necessary if (null !== $rebate && $rebate->getService() !== $this) { $rebate->setService($this); } $this->rebate = $rebate; return $this; } public function isDone(): ?bool { return $this->done; } public function removePenalty(Penalty $penalty): self { $this->penalties->removeElement($penalty); return $this; } }
Save File
Cancel