type fixes

This commit is contained in:
Yuri Kuznetsov
2021-11-04 11:36:52 +02:00
parent 1dda881422
commit b568e96407
17 changed files with 79 additions and 28 deletions
@@ -31,6 +31,8 @@ namespace Espo\Classes\FieldProcessing\Email;
use Espo\ORM\Entity;
use Espo\Repositories\EmailAddress as EmailAddressRepository;
use Espo\Core\{
FieldProcessing\Loader,
FieldProcessing\Loader\Params,
@@ -56,6 +58,8 @@ class StringDataLoader implements Loader
public function process(Entity $entity, Params $params): void
{
/** @var Email $entity */
$userEmailAdddressIdList = [];
$emailAddressCollection = $this->entityManager
@@ -84,9 +88,7 @@ class StringDataLoader implements Loader
$list = [];
foreach ($idList as $emailAddressId) {
$person = $this->entityManager
->getRepository('EmailAddress')
->getEntityByAddressId($emailAddressId, null, true);
$person = $this->getEmailAddressRepository()->getEntityByAddressId($emailAddressId, null, true);
$list[] = $person ? $person->get('name') : $names->$emailAddressId;
}
@@ -103,9 +105,7 @@ class StringDataLoader implements Loader
}
if (!array_key_exists($fromEmailAddressId, $this->fromEmailAddressNameCache)) {
$person = $this->entityManager
->getRepository('EmailAddress')
->getEntityByAddressId($fromEmailAddressId, null, true);
$person = $this->getEmailAddressRepository()->getEntityByAddressId($fromEmailAddressId, null, true);
$fromName = $person ? $person->get('name') : null;
@@ -119,4 +119,9 @@ class StringDataLoader implements Loader
$entity->set('personStringData', $fromName);
}
private function getEmailAddressRepository(): EmailAddressRepository
{
return $this->entityManager->getRepository('EmailAddress');
}
}