Bitrix API

TokensTable extends DataManager

Class TokensTable

Fields:

  • ID int mandatory
  • APP_CODE string(255) optional
  • PLATFORM string(255) optional
  • PARAMS string optional
  • DATE_CREATE datetime optional

Table of Contents

Constants

DEFAULT_TOKEN_LENGTH  = 45
TOKEN_AVAILABLE_INTERVAL  = 'T5M'
After this interval token will unavailable, format of this param is equal to param which passing to Date::add()

Methods

clearDeprecatedTokens()  : void
Delete all deprecated tokens, can use in agents
createCollection()  : EO_Tokens_Collection
createObject()  : EO_Tokens
createToken()  : array<string|int, mixed>
getById()  : EO_Tokens_Result
getByPrimary()  : EO_Tokens_Result
getEntity()  : EO_Tokens_Entity
getList()  : EO_Tokens_Result
getMap()  : array<string|int, mixed>
Returns entity map definition.
getTableName()  : string
Returns DB table name for entity
getToken()  : string|false
isTokenValid()  : bool
query()  : EO_Tokens_Query
updateToken()  : array<string|int, mixed>
wakeUpCollection()  : EO_Tokens_Collection
wakeUpObject()  : EO_Tokens

Constants

DEFAULT_TOKEN_LENGTH

public mixed DEFAULT_TOKEN_LENGTH = 45

TOKEN_AVAILABLE_INTERVAL

After this interval token will unavailable, format of this param is equal to param which passing to Date::add()

public mixed TOKEN_AVAILABLE_INTERVAL = 'T5M'

Methods

clearDeprecatedTokens()

Delete all deprecated tokens, can use in agents

public static clearDeprecatedTokens() : void

createCollection()

public static createCollection() : EO_Tokens_Collection
Return values
EO_Tokens_Collection

createObject()

public static createObject([mixed $setDefaultValues = = 'true' ]) : EO_Tokens
Parameters
$setDefaultValues : mixed = = 'true'
Return values
EO_Tokens

createToken()

public static createToken(int $userId[, null|string $token = null ][, null|DateTime $expiredAt = null ]) : array<string|int, mixed>
Parameters
$userId : int

User id.

$token : null|string = null

Token to set to user.

$expiredAt : null|DateTime = null

If set this parameter token will expired in that time, else after TOKEN_AVAILABLE_INTERVAL.

Return values
array<string|int, mixed>

getById()

public static getById(mixed $id) : EO_Tokens_Result
Parameters
$id : mixed
Return values
EO_Tokens_Result

getByPrimary()

public static getByPrimary(mixed $primary[, array<string|int, mixed> $parameters = = '[]' ]) : EO_Tokens_Result
Parameters
$primary : mixed
$parameters : array<string|int, mixed> = = '[]'
Return values
EO_Tokens_Result

getEntity()

public static getEntity() : EO_Tokens_Entity
Return values
EO_Tokens_Entity

getList()

public static getList([array<string|int, mixed> $parameters = = '[]' ]) : EO_Tokens_Result
Parameters
$parameters : array<string|int, mixed> = = '[]'
Return values
EO_Tokens_Result

getMap()

Returns entity map definition.

public static getMap() : array<string|int, mixed>

To get initialized fields @see \Bitrix\Main\Entity\Base::getFields() and \Bitrix\Main\Entity\Base::getField()

Return values
array<string|int, mixed>

getTableName()

Returns DB table name for entity

public static getTableName() : string
Return values
string

getToken()

public static getToken(int $userId) : string|false
Parameters
$userId : int

User id.

Return values
string|false

isTokenValid()

public static isTokenValid(string $token) : bool
Parameters
$token : string

Token passed from user for checking.

Return values
bool

query()

public static query() : EO_Tokens_Query
Return values
EO_Tokens_Query

updateToken()

public static updateToken(string $oldToken, int $userId[, string|null $newToken = null ][, DateTime|null $expiredAt = null ]) : array<string|int, mixed>
Parameters
$oldToken : string

Old token for finding what we want update.

$userId : int

User id.

$newToken : string|null = null

New token to set for user.

$expiredAt : DateTime|null = null

If set this parameter token will expired in that time, else after TOKEN_AVAILABLE_INTERVAL.

Return values
array<string|int, mixed>

wakeUpCollection()

public static wakeUpCollection(mixed $rows) : EO_Tokens_Collection
Parameters
$rows : mixed
Return values
EO_Tokens_Collection

wakeUpObject()

public static wakeUpObject(mixed $row) : EO_Tokens
Parameters
$row : mixed
Return values
EO_Tokens

        
On this page

Search results