Programming Language PHP

Namespace Oro\Component\MessageQueue\Job

Class Job

Method/Function setStartedAt

Total Examples 1

1 code examples of PHP Oro\Component\MessageQueue\Job\Job::setStartedAt extracted from open source projects

Was this example useful?
0
                                                    public function startChildJob(Job $job): void
    {
        if ($job->isRoot()) {
            throw new \LogicException(sprintf('Can\'t start root jobs. id: "%s"', $job->getId()));
        }

        if (!in_array($job->getStatus(), $this->getNotStartedJobStatuses(), true)) {
            throw new JobCannotBeStartedException($job);
        }

        $job->setStatus(Job::STATUS_RUNNING);
        $job->setStartedAt(new \DateTime());

        $this->jobManager->saveJob($job);
    }