ref
This commit is contained in:
@@ -31,10 +31,11 @@ namespace Espo\Jobs;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
|
||||
use Espo\Services\EmailAccount as Service;
|
||||
|
||||
use Espo\Core\{
|
||||
Job\Job,
|
||||
Job\Job\Data,
|
||||
ServiceFactory,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
@@ -42,13 +43,13 @@ use Throwable;
|
||||
|
||||
class CheckEmailAccounts implements Job
|
||||
{
|
||||
private $serviceFactory;
|
||||
private $service;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
public function __construct(ServiceFactory $serviceFactory, EntityManager $entityManager)
|
||||
public function __construct(Service $service, EntityManager $entityManager)
|
||||
{
|
||||
$this->serviceFactory = $serviceFactory;
|
||||
$this->service = $service;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
@@ -60,8 +61,6 @@ class CheckEmailAccounts implements Job
|
||||
throw new Error("No target.");
|
||||
}
|
||||
|
||||
$service = $this->serviceFactory->create('EmailAccount');
|
||||
|
||||
$entity = $this->entityManager->getEntity('EmailAccount', $targetId);
|
||||
|
||||
if (!$entity) {
|
||||
@@ -73,7 +72,7 @@ class CheckEmailAccounts implements Job
|
||||
}
|
||||
|
||||
try {
|
||||
$service->fetchFromMailServer($entity);
|
||||
$this->service->fetchFromMailServer($entity);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
throw new Error(
|
||||
|
||||
@@ -31,10 +31,11 @@ namespace Espo\Jobs;
|
||||
|
||||
use Espo\Core\Exceptions\Error;
|
||||
|
||||
use Espo\Services\InboundEmail as Service;
|
||||
|
||||
use Espo\Core\{
|
||||
Job\Job,
|
||||
Job\Job\Data,
|
||||
ServiceFactory,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
@@ -42,13 +43,13 @@ use Throwable;
|
||||
|
||||
class CheckInboundEmails implements Job
|
||||
{
|
||||
private $serviceFactory;
|
||||
private $service;
|
||||
|
||||
private $entityManager;
|
||||
|
||||
public function __construct(ServiceFactory $serviceFactory, EntityManager $entityManager)
|
||||
public function __construct(Service $service, EntityManager $entityManager)
|
||||
{
|
||||
$this->serviceFactory = $serviceFactory;
|
||||
$this->service = $service;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
@@ -60,8 +61,6 @@ class CheckInboundEmails implements Job
|
||||
throw new Error("No target.");
|
||||
}
|
||||
|
||||
$service = $this->serviceFactory->create('InboundEmail');
|
||||
|
||||
$entity = $this->entityManager->getEntity('InboundEmail', $targetId);
|
||||
|
||||
if (!$entity) {
|
||||
@@ -73,7 +72,7 @@ class CheckInboundEmails implements Job
|
||||
}
|
||||
|
||||
try {
|
||||
$service->fetchFromMailServer($entity);
|
||||
$this->service->fetchFromMailServer($entity);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user