Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
token.php
1
<?php
2
3
4
namespace
Bitrix\Sale\Exchange\Integration
;
5
6
7
use
Bitrix\Sale\Exchange\Integration\Entity\B24IntegrationRelationTable
;
8
use
Bitrix\Sale\Exchange\Integration\Entity\B24integrationTokenTable
;
9
10
class
Token
11
{
12
static
public
function
getToken
(array $fields, $guid =
null
)
13
{
14
if
($guid)
15
{
16
$fields[
"guid"
] = $guid;
17
}
18
19
return
static::createToken($fields);
20
}
21
22
static
private
function
createToken(array $fields)
23
{
24
$token =
null
;
25
if
(isset($fields[
"guid"
]))
26
{
27
$token = Entity\B24integrationTokenTable::getList([
"select"
=> [
"*"
],
"filter"
=> [
"=GUID"
=> $fields[
"guid"
]]])->fetchObject();
28
}
29
30
$token = $token ?:
new
Entity\Token();
31
$result = $token->update($fields);
32
33
return
$result->isSuccess() ? $token :
null
;
34
}
35
40
static
public
function
getExistsByGuid
($guid)
41
{
42
$token = Entity\B24integrationTokenTable::getList([
"select"
=> [
"*"
],
"filter"
=> [
"=GUID"
=> $guid]])->fetchObject();
43
return
($token);
44
}
45
46
static
public
function
delete
($guid)
47
{
48
$row =
B24integrationTokenTable::getRow
([
"filter"
=> [
"=GUID"
=> $guid]]);
49
$primary = $row ? $row[
'ID'
]:0;
50
if
($primary>0)
51
{
52
B24integrationTokenTable::delete
($primary);
53
}
54
}
55
}
Bitrix\Main\ORM\Data\DataManager\getRow
static getRow(array $parameters)
Definition
datamanager.php:410
Bitrix\Main\ORM\Data\DataManager\delete
static delete($primary)
Definition
datamanager.php:1632
Bitrix\Sale\Exchange\Integration\Entity\B24IntegrationRelationTable
Definition
b24integrationrelationtable.php:23
Bitrix\Sale\Exchange\Integration\Entity\B24integrationTokenTable
Definition
b24integrationtokentable.php:27
Bitrix\Sale\Exchange\Integration\Token
Definition
token.php:11
Bitrix\Sale\Exchange\Integration\Token\getToken
static getToken(array $fields, $guid=null)
Definition
token.php:12
Bitrix\Sale\Exchange\Integration\Token\getExistsByGuid
static getExistsByGuid($guid)
Definition
token.php:40
Bitrix\Sale\Exchange\Integration
modules
sale
lib
exchange
integration
token.php
Создано системой
1.10.0