src/Entity/PipelineMajWebMessage.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PipelineMajWebMessageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPipelineMajWebMessageRepository::class)]
  8. class PipelineMajWebMessage
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(targetEntityPipelineMajWeb::class, inversedBy'messages')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private ?PipelineMajWeb $pipelineMajWeb null;
  17.     #[ORM\Column(type'string'length20)]
  18.     private string $authorType 'client'// 'client'|'admin'
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private ?string $authorEmail null;
  21.     #[ORM\Column(type'text')]
  22.     private string $message '';
  23.     #[ORM\Column(type'datetime_immutable')]
  24.     private \DateTimeImmutable $createdAt;
  25.     #[ORM\OneToMany(mappedBy'message'targetEntityPipelineMajWebAttachment::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  26.     private Collection $attachments;
  27.     public function __construct()
  28.     {
  29.         $this->createdAt = new \DateTimeImmutable();
  30.         $this->attachments = new ArrayCollection();
  31.     }
  32.     public function getId(): ?int { return $this->id; }
  33.     public function getPipelineMajWeb(): ?PipelineMajWeb { return $this->pipelineMajWeb; }
  34.     public function setPipelineMajWeb(?PipelineMajWeb $pipelineMajWeb): self $this->pipelineMajWeb $pipelineMajWeb; return $this; }
  35.     public function getAuthorType(): string { return $this->authorType; }
  36.     public function setAuthorType(string $authorType): self $this->authorType $authorType; return $this; }
  37.     public function getAuthorEmail(): ?string { return $this->authorEmail; }
  38.     public function setAuthorEmail(?string $authorEmail): self $this->authorEmail $authorEmail; return $this; }
  39.     public function getMessage(): string { return $this->message; }
  40.     public function setMessage(string $message): self $this->message $message; return $this; }
  41.     public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; }
  42.     /** @return Collection<int, PipelineMajWebAttachment> */
  43.     public function getAttachments(): Collection { return $this->attachments; }
  44.     public function addAttachment(PipelineMajWebAttachment $attachment): self
  45.     {
  46.         if (!$this->attachments->contains($attachment)) {
  47.             $this->attachments[] = $attachment;
  48.             $attachment->setMessage($this);
  49.         }
  50.         return $this;
  51.     }
  52. }