| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- namespace App\Entity;
- use App\Repository\MessageRepository;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- 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)
- */
- private $text;
- /**
- * @ORM\ManyToOne(targetEntity=User::class, inversedBy="messages")
- * @ORM\JoinColumn(nullable=false)
- */
- private $sender;
- /**
- * @ORM\ManyToMany(targetEntity=User::class)
- */
- private $mentions;
- /**
- * @ORM\Column(type="datetime")
- */
- private $date;
- public function __construct()
- {
- $this->mentions = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getText(): ?string
- {
- return $this->text;
- }
- public function setText(string $text): self
- {
- $this->text = $text;
- return $this;
- }
- public function getSender(): ?User
- {
- return $this->sender;
- }
- public function setSender(?User $sender): self
- {
- $this->sender = $sender;
- return $this;
- }
- /**
- * @return Collection|User[]
- */
- public function getMentions(): Collection
- {
- return $this->mentions;
- }
- public function addMention(User $mention): self
- {
- if (!$this->mentions->contains($mention)) {
- $this->mentions[] = $mention;
- }
- return $this;
- }
- public function removeMention(User $mention): self
- {
- $this->mentions->removeElement($mention);
- return $this;
- }
- public function getDate(): ?\DateTimeInterface
- {
- return $this->date;
- }
- public function setDate(\DateTimeInterface $date): self
- {
- $this->date = $date;
- return $this;
- }
- }
|