Improve names for all meta methods

[MAILPOET-4966]
This commit is contained in:
David Remer
2023-02-20 08:46:16 +02:00
committed by Aschepikov
parent 8d41b5521c
commit dd3b37aba8
4 changed files with 7 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ class UpdateAutomationController {
} }
} }
$automation->deleteMetas(); $automation->deleteAllMetas();
if (array_key_exists('meta', $data)) { if (array_key_exists('meta', $data)) {
foreach ($data['meta'] as $key => $value) { foreach ($data['meta'] as $key => $value) {
$automation->setMeta($key, $value); $automation->setMeta($key, $value);

View File

@@ -190,7 +190,7 @@ class Automation {
return $this->meta[$key] ?? null; return $this->meta[$key] ?? null;
} }
public function getMetas(): array { public function getAllMetas(): array {
return $this->meta; return $this->meta;
} }
@@ -209,7 +209,7 @@ class Automation {
$this->setUpdatedAt(); $this->setUpdatedAt();
} }
public function deleteMetas(): void { public function deleteAllMetas(): void {
$this->meta = []; $this->meta = [];
$this->setUpdatedAt(); $this->setUpdatedAt();
} }

View File

@@ -52,7 +52,7 @@ class AutomationMapper {
}, $step->getNextSteps()), }, $step->getNextSteps()),
]; ];
}, $automation->getSteps()), }, $automation->getSteps()),
'meta' => (object)$automation->getMetas(), 'meta' => (object)$automation->getAllMetas(),
]; ];
} }

View File

@@ -19,7 +19,7 @@ class AutomationTest extends \MailPoetTest {
$automation->setMeta('foo', 'bar'); $automation->setMeta('foo', 'bar');
$this->assertEquals('bar', $automation->getMeta('foo')); $this->assertEquals('bar', $automation->getMeta('foo'));
$this->assertEquals(['foo' => 'bar'], $automation->getMetas()); $this->assertEquals(['foo' => 'bar'], $automation->getAllMetas());
$this->storage->updateAutomation($automation); $this->storage->updateAutomation($automation);
$storedAutomation = $this->storage->getAutomation($automation->getId()); $storedAutomation = $this->storage->getAutomation($automation->getId());
@@ -41,8 +41,8 @@ class AutomationTest extends \MailPoetTest {
$automation->setMeta('foo', 'bar'); $automation->setMeta('foo', 'bar');
$automation->setMeta('bar', 'baz'); $automation->setMeta('bar', 'baz');
$automation->deleteMetas(); $automation->deleteAllMetas();
$this->assertEmpty($automation->getMetas()); $this->assertEmpty($automation->getAllMetas());
} }
public function testAutomationComparisonWorks() { public function testAutomationComparisonWorks() {