Skip to content

Commit 3882b9e

Browse files
committed
ISSUE-345: update template property names
1 parent 7aa99b2 commit 3882b9e

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/Domain/Model/Messaging/Template.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class Template implements DomainModel, Identity
2323
private string $title;
2424

2525
#[ORM\Column(name: 'template', type: 'blob', nullable: true)]
26-
private mixed $template;
26+
private mixed $content;
2727

2828
#[ORM\Column(name: 'template_text', type: 'blob', nullable: true)]
29-
private mixed $templateText;
29+
private mixed $text;
3030

3131
#[ORM\Column(name: 'listorder', type: 'integer', nullable: true)]
3232
private ?int $listOrder = null;
@@ -50,24 +50,24 @@ public function getTitle(): string
5050
return $this->title;
5151
}
5252

53-
public function getTemplate(): ?string
53+
public function getContent(): ?string
5454
{
55-
if (is_resource($this->template)) {
56-
rewind($this->template);
57-
return stream_get_contents($this->template);
55+
if (is_resource($this->content)) {
56+
rewind($this->content);
57+
return stream_get_contents($this->content);
5858
}
5959

60-
return $this->template;
60+
return $this->content;
6161
}
6262

63-
public function getTemplateText(): ?string
63+
public function getText(): ?string
6464
{
65-
if (is_resource($this->templateText)) {
66-
rewind($this->templateText);
67-
return stream_get_contents($this->templateText);
65+
if (is_resource($this->text)) {
66+
rewind($this->text);
67+
return stream_get_contents($this->text);
6868
}
6969

70-
return $this->templateText;
70+
return $this->text;
7171
}
7272

7373
public function getListOrder(): ?int
@@ -86,16 +86,16 @@ public function setTitle(string $title): self
8686
return $this;
8787
}
8888

89-
public function setTemplate(?string $template): self
89+
public function setContent(?string $content): self
9090
{
91-
$this->template = $template !== null ? fopen('data://text/plain,' . $template, 'r') : null;
91+
$this->content = $content !== null ? fopen('data://text/plain,' . $content, 'r') : null;
9292
return $this;
9393
}
9494

9595

96-
public function setTemplateText(?string $templateText): self
96+
public function setText(?string $text): self
9797
{
98-
$this->templateText = $templateText !== null ? fopen('data://text/plain,' . $templateText, 'r') : null;
98+
$this->text = $text !== null ? fopen('data://text/plain,' . $text, 'r') : null;
9999
return $this;
100100
}
101101

tests/Integration/Domain/Repository/Fixtures/Messaging/TemplateFixture.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function load(ObjectManager $manager): void
3737
$row = array_combine($headers, $data);
3838

3939
$template = new Template($row['title']);
40-
$template->setTemplate($row['template']);
41-
$template->setTemplateText($row['template_text']);
40+
$template->setContent($row['template']);
41+
$template->setText($row['template_text']);
4242
$template->setListOrder((int)$row['listorder']);
4343

4444
$this->setSubjectId($template, (int)$row['id']);

tests/Integration/Domain/Repository/Messaging/TemplateRepositoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public function testTemplateIsPersistedAndFetchedCorrectly(): void
5656

5757
self::assertInstanceOf(Template::class, $fetched);
5858
self::assertSame('Newsletter Template', $fetched->getTitle());
59-
self::assertSame('<html><body><h1>Welcome</h1></body></html>', $fetched->getTemplate());
60-
self::assertSame('', $fetched->getTemplateText());
59+
self::assertSame('<html><body><h1>Welcome</h1></body></html>', $fetched->getContent());
60+
self::assertSame('', $fetched->getText());
6161
self::assertSame(1, $fetched->getListOrder());
6262
}
6363

0 commit comments

Comments
 (0)