From 016f152fef3d70d6aa45181812384fab3f071b36 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Wed, 24 May 2023 15:56:55 +0300 Subject: [PATCH 1/2] add note field support --- src/Bot/Model/Entity/Message/Message.php | 25 ++++++++++++++++++++++++ tests/Resources/messages.json | 1 + 2 files changed, 26 insertions(+) diff --git a/src/Bot/Model/Entity/Message/Message.php b/src/Bot/Model/Entity/Message/Message.php index 7c8c961..991acd9 100644 --- a/src/Bot/Model/Entity/Message/Message.php +++ b/src/Bot/Model/Entity/Message/Message.php @@ -121,6 +121,15 @@ class Message implements ModelInterface */ private $content; + /** + * @var string $note + * + * @Type("string") + * @Accessor(getter="getNote",setter="setNote") + * @SkipWhenEmpty() + */ + private $note; + /** * @var bool $isRead * @@ -378,6 +387,22 @@ class Message implements ModelInterface $this->content = $content; } + /** + * @return string|null + */ + public function getNote(): ?string + { + return $this->note; + } + + /** + * @param string $note + */ + public function setNote(string $note) + { + $this->note = $note; + } + /** * @return bool|null */ diff --git a/tests/Resources/messages.json b/tests/Resources/messages.json index fd0266c..462be0a 100644 --- a/tests/Resources/messages.json +++ b/tests/Resources/messages.json @@ -63,6 +63,7 @@ "first_name": "Иванов Иван" }, "content": "❤️", + "note": "!️", "quote": null, "channel_id": 61, "created_at": "2019-05-20T12:24:52Z", From a08a03c1c8547f646d658a6e090fe9f09c9451f3 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Wed, 24 May 2023 15:59:04 +0300 Subject: [PATCH 2/2] phpstan fix --- src/Bot/Model/Entity/Message/Message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bot/Model/Entity/Message/Message.php b/src/Bot/Model/Entity/Message/Message.php index 991acd9..5431b06 100644 --- a/src/Bot/Model/Entity/Message/Message.php +++ b/src/Bot/Model/Entity/Message/Message.php @@ -398,7 +398,7 @@ class Message implements ModelInterface /** * @param string $note */ - public function setNote(string $note) + public function setNote(string $note): void { $this->note = $note; }