diff --git a/CHANGELOG.md b/CHANGELOG.md index 8762c32..72e5323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +2.0.1 +===== + +* (improvement) Add `TaskLog::getTaskObject()`. + + 2.0.0 ===== diff --git a/src/Entity/TaskLog.php b/src/Entity/TaskLog.php index 71df586..ad32116 100644 --- a/src/Entity/TaskLog.php +++ b/src/Entity/TaskLog.php @@ -177,6 +177,21 @@ public function getTaskLabel () : ?string return $this->getTaskDetails()["label"] ?? null; } + /** + * Returns the unserialized cached task object + */ + public function getTaskObject () : ?object + { + $task = $this->getTaskDetails()["task"] ?? null; + $unserialized = \is_string($task) + ? unserialize($task) + : null; + + return \is_object($unserialized) + ? $unserialized + : null; + } + /** * @return bool|null whether the task succeeded/failed or null, if it hasn't run yet */