Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
token.php
1<?php
2
3
5
6
9
10class 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 {
53 }
54 }
55}
static getRow(array $parameters)
static getToken(array $fields, $guid=null)
Definition token.php:12