transactions->run(function () use ($jobId, $status, $actorUserId): void { $job = $this->jobs->findById($jobId) ?? throw new CustomerJobNotFound($jobId); $changes = $job->changeStatus($status); $job->recordCompletion($this->clock->now()); if ($changes === []) { return; } $this->jobs->save($job); $this->jobs->recordChanges($jobId, $actorUserId, $changes); }); } }