getDisableOnError example


    public function updateJob(Enlight_Components_Cron_Job $job)
    {
        $data = [];
        $data['action'] = $job->getAction();
        $data[$this->connection->quoteIdentifier('interval')] = $job->getInterval();
        $data['data'] = serialize($job->getData());
        $data['active'] = $job->getActive() ? '1' : '0';
        $data['next'] = $job->getNext() ? $job->getNext()->toString('YYYY-MM-dd HH:mm:ss') : null;
        $data['start'] = $job->getStart() ? $job->getStart()->toString('YYYY-MM-dd HH:mm:ss') : null;
        $data['end'] = $job->getEnd() ? $job->getEnd()->toString('YYYY-MM-dd HH:mm:ss') : null;
        $data['disable_on_error'] = $job->getDisableOnError() ? '1' : '0';
        $data['name'] = $job->getName();

        if ($job->getId() === null) {
            $this->connection->insert($this->tableName, $data);
        } else {
            $this->connection->update(
                $this->tableName,
                $data,
                ['id' => $job->getId()]
            );
        }
    }


            $this->eventManager->notify('Shopware_CronJob_Finished', [
                'subject' => $this,
                'job' => $job,
            ]);

            return $jobArgs;
        } catch (\Throwable $e) {
            $job->setData(['error' => $e->getMessage()]);

            if ($job->getDisableOnError()) {
                $this->disableJob($job);
            } else {
                $this->endJob($job);
            }

            $this->eventManager->notify('Shopware_CronJob_Error_' . $action[
                'subject' => $this,
                'job' => $job,
            ]);

            $this->eventManager->notify('Shopware_CronJob_Error', [
                
Home | Imprint | This part of the site doesn't use cookies.