-
The return type of the
Zenaton\Traits\Zenatonable::schedule()method is nowvoid.If you were relying on the return value you cannot use it anymore.
Before:
$schedule = (new RegisterOrderTask())->schedule('* * * * *'); // [...] Use of $schedule
After:
(new RegisterOrderTask())->schedule('* * * * *');
-
A
contextproperty, and methods::setContext()and::getContext()have been added to theZenatonabletrait.If you have some tasks or workflows using the same names you will have to rename them.
Before:
class RegisterOrderTask implements TaskInterface { use Zenaton\Trait\Zenatonable; private $context; public function __construct($context) { $this->context = $context; } public function handle() { // [...] } }
After:
class RegisterOrderTask implements TaskInterface { use Zenaton\Trait\Zenatonable; private $orderContext; public function __construct($context) { $this->orderContext = $context; } public function handle() { // [...] } }
Please note that the
::setContext()method is internal and must not be used. It is called by the Zenaton Agent to set the runtime context of tasks and workflows.
-
Using
Zenatonable::dispatch()on tasks outside of a workflow now executes tasks asynchronously.The previous behaviour, which was not documented, was to run the task synchronously. This change allows you to run a single task asynchronously without having to create a workflow.
Before:
class SingleTaskDispatchWorkflow implements WorkflowInterface { public function handle() { (new SingleTask())->dispatch(); } } (new SingleTaskDispatchWorkflow())->dispatch();
After:
(new SingleTask())->dispatch();