From 54486d40089962822ed3ab5ec12139543f9ad1c4 Mon Sep 17 00:00:00 2001 From: Alex Komarichev Date: Tue, 2 Jul 2024 15:30:36 +0300 Subject: [PATCH 1/2] Add template attachments --- .../Entity/Template/TemplateAttachment.php | 74 +++++++++++++++++++ .../Entity/Template/TemplateVariables.php | 32 ++++++++ 2 files changed, 106 insertions(+) create mode 100644 src/Bot/Model/Entity/Template/TemplateAttachment.php diff --git a/src/Bot/Model/Entity/Template/TemplateAttachment.php b/src/Bot/Model/Entity/Template/TemplateAttachment.php new file mode 100644 index 0000000..e96fd24 --- /dev/null +++ b/src/Bot/Model/Entity/Template/TemplateAttachment.php @@ -0,0 +1,74 @@ +id; + } + + /** + * @param string $id + * @return void + */ + public function setId(string $id): void + { + $this->id = $id; + } + + /** + * @return string|null + */ + public function getCaption(): ?string + { + return $this->caption; + } + + /** + * @param string $caption + */ + public function setCaption(string $caption): void + { + $this->caption = $caption; + } +} diff --git a/src/Bot/Model/Entity/Template/TemplateVariables.php b/src/Bot/Model/Entity/Template/TemplateVariables.php index 1c2ffeb..908a5e0 100644 --- a/src/Bot/Model/Entity/Template/TemplateVariables.php +++ b/src/Bot/Model/Entity/Template/TemplateVariables.php @@ -1,5 +1,13 @@ $attachments + * + * @Type("array") + * @Accessor(getter="getAttachments",setter="setAttachments") + */ + private $attachments; + /** * @var array $body * @@ -85,4 +101,20 @@ class TemplateVariables implements ModelInterface { $this->buttons = $buttons; } + + /** + * @return TemplateAttachment[]|null + */ + public function getAttachments(): ?array + { + return $this->attachments; + } + + /** + * @param TemplateAttachment[] $attachments + */ + public function setAttachments(array $attachments): void + { + $this->attachments = $attachments; + } } From 290d5f87e5465fc962a9fa04fba117c3499091c5 Mon Sep 17 00:00:00 2001 From: Alex Komarichev Date: Tue, 2 Jul 2024 15:35:20 +0300 Subject: [PATCH 2/2] phpstan --- src/Bot/Model/Entity/Template/TemplateAttachment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bot/Model/Entity/Template/TemplateAttachment.php b/src/Bot/Model/Entity/Template/TemplateAttachment.php index e96fd24..913d680 100644 --- a/src/Bot/Model/Entity/Template/TemplateAttachment.php +++ b/src/Bot/Model/Entity/Template/TemplateAttachment.php @@ -23,7 +23,7 @@ use RetailCrm\Mg\Bot\Model\ModelInterface; class TemplateAttachment implements ModelInterface { /** - * @var string $header + * @var string $id * * @Type("string") * @Accessor(getter="getId",setter="setId") @@ -31,7 +31,7 @@ class TemplateAttachment implements ModelInterface private $id; /** - * @var string $header + * @var string $caption * * @Type("string") * @Accessor(getter="getCaption",setter="setCaption")