<?php
namespace App\Entity;
use App\Repository\MessageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MessageRepository::class)]
class Message
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $type;
#[ORM\Column(type: 'text', nullable: true)]
private $content;
#[ORM\OneToOne(targetEntity: Booking::class, cascade: ['persist', 'remove'])]
private $booking;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'sentMessages')]
private $sender;
#[ORM\ManyToOne(targetEntity: Conversation::class, inversedBy: 'messages')]
private $conversation;
#[ORM\Column(type: 'boolean')]
private $isReaded;
#[ORM\OneToOne(targetEntity: PaymentRequest::class, cascade: ['persist', 'remove'])]
private $paymentRequest;
#[ORM\OneToMany(targetEntity: AttachedFile::class, mappedBy: 'message')]
private $attachedFiles;
#[ORM\Column(type: 'string', nullable: true)]
private $toRate;
#[ORM\OneToOne(targetEntity: Note::class, cascade: ['persist', 'remove'])]
private $note;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bookingRef = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $lastReminder = null;
public function __construct()
{
$this->attachedFiles = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getBooking(): ?Booking
{
return $this->booking;
}
public function setBooking(?Booking $booking): self
{
$this->booking = $booking;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getSender(): ?User
{
return $this->sender;
}
public function setSender(?User $sender): self
{
$this->sender = $sender;
return $this;
}
public function getConversation(): ?Conversation
{
return $this->conversation;
}
public function setConversation(?Conversation $conversation): self
{
$this->conversation = $conversation;
return $this;
}
public function getIsReaded(): ?bool
{
return $this->isReaded;
}
public function setIsReaded(bool $isReaded): self
{
$this->isReaded = $isReaded;
return $this;
}
public function getPaymentRequest(): ?PaymentRequest
{
return $this->paymentRequest;
}
public function setPaymentRequest(?PaymentRequest $paymentRequest): self
{
$this->paymentRequest = $paymentRequest;
return $this;
}
/**
* @return Collection|AttachedFile[]
*/
public function getAttachedFiles(): Collection
{
return $this->attachedFiles;
}
public function addAttachedFile(AttachedFile $attachedFile): self
{
if (!$this->attachedFiles->contains($attachedFile)) {
$this->attachedFiles[] = $attachedFile;
$attachedFile->setMessage($this);
}
return $this;
}
public function removeAttachedFile(AttachedFile $attachedFile): self
{
if ($this->attachedFiles->removeElement($attachedFile)) {
// set the owning side to null (unless already changed)
if ($attachedFile->getMessage() === $this) {
$attachedFile->setMessage(null);
}
}
return $this;
}
public function getToRate(): ?string
{
return $this->toRate;
}
public function setToRate(?string $toRate): self
{
$this->toRate = $toRate;
return $this;
}
public function getNote(): ?Note
{
return $this->note;
}
public function setNote(?Note $note): self
{
$this->note = $note;
return $this;
}
public function getBookingRef(): ?string
{
return $this->bookingRef;
}
public function setBookingRef(?string $bookingRef): static
{
$this->bookingRef = $bookingRef;
return $this;
}
public function getLastReminder(): ?\DateTimeInterface
{
return $this->lastReminder;
}
public function setLastReminder(?\DateTimeInterface $lastReminder): static
{
$this->lastReminder = $lastReminder;
return $this;
}
}