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