1
0
mirror of synced 2025-02-12 13:09:22 +03:00
Neur0toxine 5f69051859
Программа лояльности
* New module structure (refactoring)
* Simple serializer and deserializer with models, new architecture
* Move logic to strategies
* Partial api client facade implementation (full implementation is not necessary for now)
* Loyalty feature installer
* Sms verification order (#167)
* Make updater self-sufficient
* Fix for order submit & fix for incorrect component rendering in the constructor
* Fix for loyalty personal area error handling
* Fix for cart component identity
* Fix for softlock when customer cannot be registered in loyalty

Co-authored-by: Сергей Чазов <45812598+Chazovs@users.noreply.github.com>
Co-authored-by: Sergey Chazov <oitv18@gmail.com>
2021-11-16 10:48:26 +03:00

64 lines
1.5 KiB
PHP

<?php
namespace Intaro\RetailCrm\Repository;
use Bitrix\Main\ORM\Objectify\EntityObject;
use Bitrix\Main\UserTable;
use RetailcrmConfigProvider;
/**
* Class ManagerRepository
*
* @package Intaro\RetailCrm\Repository
*/
class ManagerRepository
{
/**
* @param array $newMatches
*
* @return void
* @throws \Bitrix\Main\ArgumentOutOfRangeException
*/
public function addManagersToMapping(array $newMatches): void
{
$usersMap = RetailcrmConfigProvider::getUsersMap();
if (is_array($usersMap)) {
$recordData = array_merge($usersMap, $newMatches);
} else {
$recordData = $newMatches;
}
RetailcrmConfigProvider::setUsersMap($recordData);
}
/**
* @param string $email
*
* @return int|null
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\ObjectPropertyException
* @throws \Bitrix\Main\SystemException
*/
public function getManagerBitrixIdByEmail(string $email): ?int
{
/** @var \Bitrix\Main\ORM\Objectify\EntityObject $user */
$user = UserTable::query()
->addSelect('ID')
->where('EMAIL', $email)
->exec()
->fetchObject();
if ($user instanceof EntityObject) {
$userId = $user->get('ID');
if (is_int($userId) && $userId > 0) {
return $userId;
}
}
return null;
}
}