Bitrix API

SubscribeTable extends DataManager

Class SubscribeTable

Fields:

  • ID int mandatory
  • DATE_FROM datetime mandatory
  • DATE_TO datetime optional
  • USER_CONTACT string mandatory
  • CONTACT_TYPE int mandatory
  • USER_ID int optional
  • USER reference to [](\Bitrix\Main\UserTable)
  • ITEM_ID int mandatory
  • PRODUCT reference to [](ProductTable)
  • IBLOCK_ELEMENT reference to [](\Bitrix\Iblock\ElementTable)
  • NEED_SENDING bool default=N
  • SITE_ID int mandatory

Table of Contents

Constants

AGENT_INTERVAL  = 10
AGENT_TIME_OUT  = 10
CONTACT_TYPE_EMAIL  = 1
EVENT_ADD_CONTACT_TYPE  = 'onAddContactType'
EVENT_ON_ADD  = "OnAdd"
EVENT_ON_AFTER_ADD  = "OnAfterAdd"
EVENT_ON_AFTER_DELETE  = "OnAfterDelete"
EVENT_ON_AFTER_UPDATE  = "OnAfterUpdate"
EVENT_ON_BEFORE_ADD  = "OnBeforeAdd"
EVENT_ON_BEFORE_DELETE  = "OnBeforeDelete"
EVENT_ON_BEFORE_UPDATE  = "OnBeforeUpdate"
EVENT_ON_DELETE  = "OnDelete"
EVENT_ON_UPDATE  = "OnUpdate"
LIMIT_SEND  = 50

Methods

add()  : AddResult
Adds row to entity table
addMulti()  : AddResult
Adds several rows to entity table.
checkFields()  : mixed
Checks the data fields before saving to DB. Result stores in the $result object
checkPermissionSubscribe()  : bool
The method checks permission the subscription for the product.
cleanCache()  : void
Cleans the tablet cache after data modifications.
createCollection()  : EO_Subscribe_Collection
createObject()  : EO_Subscribe
cryptoEnabled()  : bool
Returns true if crypto is enabled for a field.
delete()  : DeleteResult
Deletes row in entity table by primary key
enableCrypto()  : mixed
Sets a flag indicating crypto support for a field.
getById()  : EO_Subscribe_Result
Returns selection by entity's primary key
getByPrimary()  : EO_Subscribe_Result
Returns selection by entity's primary key and optional parameters for getList()
getCollectionClass()  : string|Collection
Returns class of Object collection for current entity.
getCollectionClassName()  : string
Returns class name (without namespace) of Object collection for current entity.
getCollectionParentClass()  : Collection|string
getConnectionName()  : string
Returns connection name for entity
getContactTypes()  : array<string|int, mixed>
The method returns an array of available types and allows you to add a type using an event.
getCount()  : int
Performs COUNT query on entity and returns the result.
getEntity()  : EO_Subscribe_Entity
Returns entity object
getEntityClass()  : Entity|string
getList()  : EO_Subscribe_Result
Executes the query and returns selection by parameters of the query. This function is an alias to the Query object functions
getMap()  : array<string|int, mixed>
Returns entity map definition.
getObjectClass()  : string|EntityObject
Returns class of Object for current entity.
getObjectClassName()  : string
Returns class name (without namespace) of Object for current entity.
getObjectParentClass()  : EntityObject|string
getQueryClass()  : Query|string
getRow()  : array<string|int, mixed>|null
Returns one row (or null) by parameters for getList()
getRowById()  : array<string|int, mixed>|null
Returns one row (or null) by entity's primary key
getTableName()  : string
Returns DB table name for entity.
getTitle()  : string|null
getUfId()  : mixed
isCacheable()  : bool
You can disable cache for the tablet completely.
isUtm()  : mixed
isUts()  : mixed
onAdd()  : mixed
onAddContactType()  : void
Handler onAddContactType. Adding a new contact type.
onAfterAdd()  : mixed
onAfterDelete()  : mixed
onAfterUpdate()  : mixed
onBeforeAdd()  : mixed
onBeforeDelete()  : mixed
onBeforeUpdate()  : mixed
onDelete()  : mixed
onIblockElementDelete()  : bool
Handler onIblockElementDelete for delete the data on the subscription in case of removal of product.
onProductSetAvailableUpdate()  : bool
Method OnProductSetAvailableUpdate for send a notification to subscribers about positive change available.
onProductUpdate()  : bool
onSaleOrderSaved()  : void
Handler OnSaleOrderSaved to unsubscribe when ordering.
onUpdate()  : mixed
onUserDelete()  : void
Handler onUserDelete for change subscription data when removing a user.
postInitialize()  : null
query()  : EO_Subscribe_Query
Creates and returns the Query object for the entity
runAgentToSendNotice()  : bool
The method runs the agent to send notifications to subscribers.
runAgentToSendRepeatedNotice()  : bool
The method runs the agent to send repeated notifications to subscribers.
sendNotice()  : string
Agent function. Get the necessary data and send notifications to users.
sendRepeatedNotice()  : string
Agent function. Get the necessary data and send notifications to users.
setCurrentDeletingObject()  : void
setDefaultScope()  : Query
setOldProductAvailable()  : bool
The method stores the value of availability of product before updating.
unsetEntity()  : mixed
update()  : UpdateResult
Updates row in entity table by primary key
updateMulti()  : UpdateResult
validateNeedSending()  : array<string|int, mixed>
Returns validators for NEED_SENDING field.
validateSiteId()  : array<string|int, mixed>
Returns validators for SITE_ID field.
wakeUpCollection()  : EO_Subscribe_Collection
wakeUpObject()  : EO_Subscribe

Constants

AGENT_INTERVAL

public mixed AGENT_INTERVAL = 10

AGENT_TIME_OUT

public mixed AGENT_TIME_OUT = 10

CONTACT_TYPE_EMAIL

public mixed CONTACT_TYPE_EMAIL = 1

EVENT_ADD_CONTACT_TYPE

public mixed EVENT_ADD_CONTACT_TYPE = 'onAddContactType'

EVENT_ON_AFTER_ADD

public mixed EVENT_ON_AFTER_ADD = "OnAfterAdd"

EVENT_ON_AFTER_DELETE

public mixed EVENT_ON_AFTER_DELETE = "OnAfterDelete"

EVENT_ON_AFTER_UPDATE

public mixed EVENT_ON_AFTER_UPDATE = "OnAfterUpdate"

EVENT_ON_BEFORE_ADD

public mixed EVENT_ON_BEFORE_ADD = "OnBeforeAdd"

EVENT_ON_BEFORE_DELETE

public mixed EVENT_ON_BEFORE_DELETE = "OnBeforeDelete"

EVENT_ON_BEFORE_UPDATE

public mixed EVENT_ON_BEFORE_UPDATE = "OnBeforeUpdate"

EVENT_ON_DELETE

public mixed EVENT_ON_DELETE = "OnDelete"

EVENT_ON_UPDATE

public mixed EVENT_ON_UPDATE = "OnUpdate"

Methods

add()

Adds row to entity table

public static add(array<string|int, mixed> $data) : AddResult
Parameters
$data : array<string|int, mixed>

An array with fields like array( "fields" => array( "FIELD1" => "value1", "FIELD2" => "value2", ), "auth_context" => \Bitrix\Main\Authentication\Context object ) or just a plain array of fields.

This method uses the default strategy defined in the class.

Tags
throws
Exception
Return values
AddResult

Contains ID of inserted row

addMulti()

Adds several rows to entity table.

public static addMulti(mixed $rows[, bool $ignoreEvents = false ]) : AddResult

This method uses the default strategy defined in the class.

Parameters
$rows : mixed
$ignoreEvents : bool = false
Tags
throws
ArgumentException
throws
SystemException
Return values
AddResult

checkFields()

Checks the data fields before saving to DB. Result stores in the $result object

public static checkFields(Result $result, mixed $primary, array<string|int, mixed> $data) : mixed
Parameters
$result : Result
$primary : mixed
$data : array<string|int, mixed>
Tags
throws
ArgumentException
throws
SystemException

checkPermissionSubscribe()

The method checks permission the subscription for the product.

public static checkPermissionSubscribe(string $subscribe) : bool
Parameters
$subscribe : string

The field value SUBSCRIBE of the product.

Tags
throws
ArgumentNullException
Return values
bool

cleanCache()

Cleans the tablet cache after data modifications.

public static cleanCache() : void

createCollection()

public static createCollection() : EO_Subscribe_Collection
Return values
EO_Subscribe_Collection

createObject()

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

cryptoEnabled()

Returns true if crypto is enabled for a field.

public static cryptoEnabled(string $field[, string $table = null ]) : bool
Parameters
$field : string
$table : string = null
Return values
bool

delete()

Deletes row in entity table by primary key

public static delete(mixed $primary) : DeleteResult
Parameters
$primary : mixed
Tags
throws
Exception
Return values
DeleteResult

enableCrypto()

Sets a flag indicating crypto support for a field.

public static enableCrypto(string $field[, string $table = null ][, bool $mode = true ]) : mixed
Parameters
$field : string
$table : string = null
$mode : bool = true

getById()

Returns selection by entity's primary key

public static getById(mixed $id) : EO_Subscribe_Result
Parameters
$id : mixed

Primary key of the entity

Return values
EO_Subscribe_Result

getByPrimary()

Returns selection by entity's primary key and optional parameters for getList()

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

Primary key of the entity

$parameters : array<string|int, mixed> = = '[]'

Additional parameters for getList()

Return values
EO_Subscribe_Result

getCollectionClass()

Returns class of Object collection for current entity.

public static getCollectionClass() : string|Collection
Return values
string|Collection

getCollectionClassName()

Returns class name (without namespace) of Object collection for current entity.

public final static getCollectionClassName() : string
Return values
string

getConnectionName()

Returns connection name for entity

public static getConnectionName() : string
Return values
string

getContactTypes()

The method returns an array of available types and allows you to add a type using an event.

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

When you add a new type of need to add a 'RULE' to validate the field 'USER_CONTACT'. And also a function that will send messages to the specified type.

Return values
array<string|int, mixed>

array(typeId=>array(ID => typeId, NAME => typeName, RULE => validateRule, HANDLER => function())).

getCount()

Performs COUNT query on entity and returns the result.

public static getCount([array<string|int, mixed>|ConditionTree $filter = array() ][, array<string|int, mixed> $cache = array() ]) : int
Parameters
$filter : array<string|int, mixed>|ConditionTree = array()
$cache : array<string|int, mixed> = array()

An array of cache options "ttl" => integer indicating cache TTL

Tags
throws
ObjectPropertyException
throws
SystemException
Return values
int

getEntity()

Returns entity object

public static getEntity() : EO_Subscribe_Entity
Return values
EO_Subscribe_Entity

getList()

Executes the query and returns selection by parameters of the query. This function is an alias to the Query object functions

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

An array of query parameters, available keys are:
"select" => array of fields in the SELECT part of the query, aliases are possible in the form of "alias"=>"field";
"filter" => array of filters in the WHERE/HAVING part of the query in the form of "(condition)field"=>"value"; also could be an instance of Filter;
"group" => array of fields in the GROUP BY part of the query;
"order" => array of fields in the ORDER BY part of the query in the form of "field"=>"asc|desc";
"limit" => integer indicating maximum number of rows in the selection (like LIMIT n in MySql);
"offset" => integer indicating first row number in the selection (like LIMIT n, 100 in MySql);
"runtime" => array of entity fields created dynamically;
"cache => array of cache options:
"ttl" => integer indicating cache TTL;
"cache_joins" => boolean enabling to cache joins, false by default.

Return values
EO_Subscribe_Result

getMap()

Returns entity map definition.

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

getObjectClassName()

Returns class name (without namespace) of Object for current entity.

public final static getObjectClassName() : string
Return values
string

getRow()

Returns one row (or null) by parameters for getList()

public static getRow(array<string|int, mixed> $parameters) : array<string|int, mixed>|null
Parameters
$parameters : array<string|int, mixed>

Primary key of the entity

Tags
throws
ArgumentException
throws
ObjectPropertyException
throws
SystemException
Return values
array<string|int, mixed>|null

getRowById()

Returns one row (or null) by entity's primary key

public static getRowById(mixed $id[, array<string|int, mixed> $parameters = [] ]) : array<string|int, mixed>|null
Parameters
$id : mixed

Primary key of the entity

$parameters : array<string|int, mixed> = []

Additional parameters for getList()

Tags
throws
ArgumentException
throws
ObjectPropertyException
throws
SystemException
Return values
array<string|int, mixed>|null

getTableName()

Returns DB table name for entity.

public static getTableName() : string
Return values
string

getTitle()

public static getTitle() : string|null
Return values
string|null

isCacheable()

You can disable cache for the tablet completely.

public static isCacheable() : bool
Return values
bool

onAddContactType()

Handler onAddContactType. Adding a new contact type.

public static onAddContactType(array<string|int, mixed> &$contactTypes) : void
Parameters
$contactTypes : array<string|int, mixed>

Contact type.

onIblockElementDelete()

Handler onIblockElementDelete for delete the data on the subscription in case of removal of product.

public static onIblockElementDelete(int $productId) : bool
Parameters
$productId : int

Product identifier.

Return values
bool

onProductSetAvailableUpdate()

Method OnProductSetAvailableUpdate for send a notification to subscribers about positive change available.

public static onProductSetAvailableUpdate(int $productId, array<string|int, mixed> $fields) : bool
Parameters
$productId : int

Product identifier.

$fields : array<string|int, mixed>

An array of event data.

Return values
bool

onProductUpdate()

public static onProductUpdate(int $productId, array<string|int, mixed> $fields) : bool

deprecated since catalog 17.6.0 Method for send a notification to subscribers about positive change available.

Parameters
$productId : int

Product identifier.

$fields : array<string|int, mixed>

An array of event data.

Return values
bool

onSaleOrderSaved()

Handler OnSaleOrderSaved to unsubscribe when ordering.

public static onSaleOrderSaved(Event $event) : void
Parameters
$event : Event

Object event.

Tags
throws
ArgumentException

onUserDelete()

Handler onUserDelete for change subscription data when removing a user.

public static onUserDelete(int $userId) : void
Parameters
$userId : int

Id user.

postInitialize()

public static postInitialize(Entity $entity) : null
Parameters
$entity : Entity
Return values
null

query()

Creates and returns the Query object for the entity

public static query() : EO_Subscribe_Query
Return values
EO_Subscribe_Query

runAgentToSendNotice()

The method runs the agent to send notifications to subscribers.

public static runAgentToSendNotice(int $productId) : bool
Parameters
$productId : int

Product identifier.

Return values
bool

runAgentToSendRepeatedNotice()

The method runs the agent to send repeated notifications to subscribers.

public static runAgentToSendRepeatedNotice(int $productId) : bool
Parameters
$productId : int

Product identifier.

Return values
bool

sendNotice()

Agent function. Get the necessary data and send notifications to users.

public static sendNotice() : string
Return values
string

sendRepeatedNotice()

Agent function. Get the necessary data and send notifications to users.

public static sendRepeatedNotice() : string
Return values
string

setOldProductAvailable()

The method stores the value of availability of product before updating.

public static setOldProductAvailable(int $productId, string $available) : bool
Parameters
$productId : int

Product id.

$available : string

The field value AVAILABLE of the product.

Return values
bool

unsetEntity()

public static unsetEntity(mixed $class) : mixed
Parameters
$class : mixed

update()

Updates row in entity table by primary key

public static update(mixed $primary, array<string|int, mixed> $data) : UpdateResult
Parameters
$primary : mixed
$data : array<string|int, mixed>

An array with fields like array( "fields" => array( "FIELD1" => "value1", "FIELD2" => "value2", ), "auth_context" => \Bitrix\Main\Authentication\Context object ) or just a plain array of fields.

Tags
throws
Exception
Return values
UpdateResult

updateMulti()

public static updateMulti(array<string|int, mixed> $primaries, array<string|int, mixed> $data[, bool $ignoreEvents = false ]) : UpdateResult
Parameters
$primaries : array<string|int, mixed>
$data : array<string|int, mixed>
$ignoreEvents : bool = false
Tags
throws
ArgumentException
throws
SystemException
Return values
UpdateResult

validateNeedSending()

Returns validators for NEED_SENDING field.

public static validateNeedSending() : array<string|int, mixed>
Return values
array<string|int, mixed>

validateSiteId()

Returns validators for SITE_ID field.

public static validateSiteId() : array<string|int, mixed>
Return values
array<string|int, mixed>

wakeUpCollection()

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

wakeUpObject()

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

        
On this page

Search results