Skip to content

EspoCRM – Open Source CRM Application

Drop job service name support

Yurii1fb711df0803
diff --git a/application/Espo/Core/Job/JobRunner.php b/application/Espo/Core/Job/JobRunner.php
index 0420ebe1ed..cdb35f97b7 100644
--- a/application/Espo/Core/Job/JobRunner.php
+++ b/application/Espo/Core/Job/JobRunner.php
@@ -30,7 +30,6 @@
namespace Espo\Core\Job;
use Espo\Core\ORM\EntityManager;
-use Espo\Core\ServiceFactory;
use Espo\Core\Utils\Log;
use Espo\Core\Utils\System;
use Espo\Core\Job\Job\Data;
@@ -48,7 +47,6 @@ class JobRunner
private JobFactory $jobFactory,
private ScheduleUtil $scheduleUtil,
private EntityManager $entityManager,
- private ServiceFactory $serviceFactory,
private Log $log,
) {}
@@ -119,8 +117,6 @@ class JobRunner
$this->runJobNamed($jobEntity);
} else if ($jobEntity->getClassName()) {
$this->runJobWithClassName($jobEntity);
- } else if ($jobEntity->getServiceName()) {
- $this->runService($jobEntity);
} else {
$id = $jobEntity->getId();
@@ -224,37 +220,6 @@ class JobRunner
$job->run($data);
}
- private function runService(JobEntity $jobEntity): void
- {
- $serviceName = $jobEntity->getServiceName();
-
- if (!$serviceName) {
- throw new RuntimeException("Job with empty serviceName.");
- }
-
- if (!$this->serviceFactory->checkExists($serviceName)) {
- throw new RuntimeException("No service $serviceName.");
- }
-
- $service = $this->serviceFactory->create($serviceName);
-
- $methodName = $jobEntity->getMethodName();
-
- if (!$methodName) {
- throw new RuntimeException('Job with empty methodName.');
- }
-
- if (!method_exists($service, $methodName)) {
- throw new RuntimeException("No method '$methodName' in service '$serviceName'.");
- }
-
- $service->$methodName(
- $jobEntity->getData(),
- $jobEntity->getTargetId(),
- $jobEntity->getTargetType()
- );
- }
-
private function setJobRunning(JobEntity $jobEntity): void
{
if (!$jobEntity->getStartedAt()) {
diff --git a/application/Espo/Entities/Job.php b/application/Espo/Entities/Job.php
index 650789d4b6..27047295f3 100644
--- a/application/Espo/Entities/Job.php
+++ b/application/Espo/Entities/Job.php
@@ -124,22 +124,6 @@ class Job extends Entity
return $this->get('className');
}
- /**
- * Get a service name.
- */
- public function getServiceName(): ?string
- {
- return $this->get('serviceName');
- }
-
- /**
- * Get a method name.
- */
- public function getMethodName(): ?string
- {
- return $this->get('methodName');
- }
-
/**
* Get a scheduled job ID.
*/
diff --git a/application/Espo/Resources/metadata/entityDefs/Job.json b/application/Espo/Resources/metadata/entityDefs/Job.json
index 5c2c315e0e..e2d212f3c5 100644
--- a/application/Espo/Resources/metadata/entityDefs/Job.json
+++ b/application/Espo/Resources/metadata/entityDefs/Job.json
@@ -36,15 +36,6 @@
"required": true,
"maxLength": 255
},
- "serviceName": {
- "type": "varchar",
- "required": true,
- "maxLength": 100
- },
- "methodName": {
- "type": "varchar",
- "maxLength": 100
- },
"job": {
"type": "varchar",
"view": "views/scheduled-job/fields/job"