|
@@ -40,9 +40,15 @@ class Message
|
|
|
*/
|
|
*/
|
|
|
private $date;
|
|
private $date;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @ORM\ManyToOne(targetEntity=Message::class, inversedBy="replies")
|
|
|
|
|
+ */
|
|
|
|
|
+ private $replies;
|
|
|
|
|
+
|
|
|
public function __construct()
|
|
public function __construct()
|
|
|
{
|
|
{
|
|
|
$this->mentions = new ArrayCollection();
|
|
$this->mentions = new ArrayCollection();
|
|
|
|
|
+ $this->replies = new ArrayCollection();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getId(): ?int
|
|
public function getId(): ?int
|
|
@@ -109,4 +115,38 @@ class Message
|
|
|
|
|
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function getReplies(): ?self
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->replies;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function setReplies(?self $replies): self
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->replies = $replies;
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function addReply(self $reply): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->replies->contains($reply)) {
|
|
|
|
|
+ $this->replies[] = $reply;
|
|
|
|
|
+ $reply->setReplies($this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function removeReply(self $reply): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->replies->removeElement($reply)) {
|
|
|
|
|
+ // set the owning side to null (unless already changed)
|
|
|
|
|
+ if ($reply->getReplies() === $this) {
|
|
|
|
|
+ $reply->setReplies(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|