EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Ref
Yurii167dbcb46083
diff --git a/application/Espo/Repositories/UserData.php b/application/Espo/Repositories/UserData.phpindex fd7748555d..23b44d54a5 100644--- a/application/Espo/Repositories/UserData.php+++ b/application/Espo/Repositories/UserData.php@@ -40,19 +40,19 @@ use Espo\Core\Repositories\Database;*/class UserData extends Database{+ private const string ATTR_USER_ID = 'userId';+public function getByUserId(string $userId): ?UserDataEntity{$userData = $this- ->where(['userId' => $userId])+ ->where([self::ATTR_USER_ID => $userId])->findOne();if ($userData) {return $userData;}- $user = $this->entityManager- ->getRepository(UserEntity::ENTITY_TYPE)- ->getById($userId);+ $user = $this->entityManager->getRepositoryByClass(UserEntity::class)->getById($userId);if (!$user) {return null;@@ -60,7 +60,7 @@ class UserData extends Database$userData = $this->getNew();- $userData->set('userId', $userId);+ $userData->set(self::ATTR_USER_ID, $userId);$this->save($userData, [SaveOption::SILENT => true,diff --git a/application/Espo/Tools/UserSecurity/Service.php b/application/Espo/Tools/UserSecurity/Service.phpindex 602b8b7398..2f18178bc7 100644--- a/application/Espo/Tools/UserSecurity/Service.php+++ b/application/Espo/Tools/UserSecurity/Service.php@@ -106,8 +106,7 @@ class Service$isReset = $data->reset ?? false;- /** @var ?User $user */- $user = $this->entityManager->getEntityById(User::ENTITY_TYPE, $id);+ $user = $this->entityManager->getRepositoryByClass(User::class)->getById($id);if (!$user) {throw new NotFound();