ntArray;
}
public function needsFullValidation(): bool {
return in_array($this->status, [Automation::STATUS_ACTIVE, Automation::STATUS_DEACTIVATING], true);
}
public function toArray(): array {
return [
'id' => $this->id,
'name' => $this->name,
'status' => $this->status,
'author' => $this->author->ID,
'created_at' => $this->createdAt->format(DateTimeImmutable::W3C),
'updated_at' => $this->updatedAt->format(DateTimeImmutable::W3C),
'activated_at' => $this->activatedAt ? $this->activatedAt->format(DateTimeImmutable::W3C) : null,
'steps' => Json::encode(
array_map(function (Step $step) {
return $step->toArray();
}, $this->steps)
),
'meta' => Json::encode($this->meta),
];
}
private function setUpdatedAt(): void {
$this->updatedAt = new DateTimeImmutable();
}
/**
* @param string $key
* @return mixed|null
*/
public function getMeta(string $key) {
return $this->meta[$key] ?? null;
}
public function getAllMetas(): array {
return $this->meta;
}
/**
* @param string $key
* @param mixed $value
* @return void
*/
public function setMeta(string $key, $value): void {
$this->meta[$key] = $value;
$this->setUpdatedAt();
}
public function deleteMeta(string $key): void {
unset($this->meta[$key]);
$this->setUpdatedAt();
}
public function deleteAllMetas(): void {
$this->meta = [];
$this->setUpdatedAt();
}
public static function fromArray(array $data): self {
// TODO: validation
$automation = new self(
$data['name'],
array_map(function (array $stepData): Step {
return Step::fromArray($stepData);
}, Json::decode($data['steps'])),
new \WP_User((int)$data['author'])
);
$automation->id = (int)$data['id'];
$automation->versionId = (int)$data['version_id'];
$automation->status = $data['status'];
$automation->createdAt = new DateTimeImmutable($data['created_at']);
$automation->updatedAt = new DateTimeImmutable($data['updated_at']);
$automation->activatedAt = $data['activated_at'] !== null ? new DateTimeImmutable($data['activated_at']) : null;
$automation->meta = $data['meta'] ? Json::decode($data['meta']) : [];
return $automation;
}
}
Fatal error: Uncaught Error: Class "MailPoet\Automation\Engine\Data\Automation" not found in /htdocs/wp-content/plugins/mailpoet/lib/Automation/Engine/Storage/AutomationStorage.php:226
Stack trace:
#0 /htdocs/wp-content/plugins/mailpoet/lib/Automation/Engine/Engine.php(95): MailPoet\Automation\Engine\Storage\AutomationStorage->getActiveTriggerKeys()
#1 /htdocs/wp-content/plugins/mailpoet/lib/Automation/Engine/Engine.php(79): MailPoet\Automation\Engine\Engine->registerActiveTriggerHooks()
#2 /htdocs/wp-content/plugins/mailpoet/lib/Config/Initializer.php(385): MailPoet\Automation\Engine\Engine->initialize()
#3 /htdocs/wp-includes/class-wp-hook.php(324): MailPoet\Config\Initializer->initialize('')
#4 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#5 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /htdocs/wp-settings.php(704): do_action('init')
#7 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...')
#8 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...')
#9 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...')
#10 /htdocs/index.php(17): require('/htdocs/wp-blog...')
#11 {main}
thrown in /htdocs/wp-content/plugins/mailpoet/lib/Automation/Engine/Storage/AutomationStorage.php on line 226