Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.0.1
=====

* (improvement) Add `TaskLog::getTaskObject()`.


2.0.0
=====

Expand Down
15 changes: 15 additions & 0 deletions src/Entity/TaskLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down