PrototypeItem extends PrototypeItemDataManager
Base entity data manager
Table of Contents
Constants
- DEFAULT_SORT = 1000
- 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"
Methods
- add() : AddResult
- Adds row to entity table
- addMulti() : AddResult
- checkFields() : mixed
- Checks the data fields before saving to DB. Result stores in the $result object
- cleanCache() : void
- Cleans the tablet cache after data modifications.
- createCollection() : null
- createObject() : null
- cryptoEnabled() : bool
- Returns true if crypto is enabled for a field.
- delete() : DeleteResult
- Deletes row in entity table by primary key
- deleteUserFieldValues() : Result
- disableUserFieldsCheck() : void
- This method disabled check that required user fields are not empty for the next saving (no matter, add or update).
- enableCrypto() : mixed
- Sets a flag indicating crypto support for a field.
- getById() : Result
- Returns selection by entity's primary key
- getByPrimary() : 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
- getCount() : int
- Performs COUNT query on entity and returns the result.
- getDefaultCategoryId() : int|null
- getDefaultStageId() : string|null
- getEntity() : Entity
- Returns entity object
- getEntityClass() : Entity|string
- getFactory() : Factory|null
- getFieldsContextDataClass() : string
- getFullTextDataClass() : string|PrototypeItemIndex
- getFullTextReferenceField() : Reference
- getItemUserFieldEntityId() : string|null
- getList() : 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, Field>
- 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
- getOwnFieldNames() : array<string|int, mixed>
- Returns list of field names that are not user fields.
- 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
- getType() : array<string|int, mixed>|null
- getUfId() : mixed
- getUserFieldValues() : array<string|int, mixed>|null
- isCacheable() : bool
- You can disable cache for the tablet completely.
- isOwnField() : bool
- isUtm() : mixed
- isUts() : mixed
- onAdd() : mixed
- onAfterAdd() : EventResult
- onAfterDelete() : EventResult
- onAfterUpdate() : EventResult
- onBeforeAdd() : EventResult
- onBeforeDelete() : EventResult
- onBeforeUpdate() : EventResult
- onDelete() : mixed
- onUpdate() : mixed
- postInitialize() : null
- prepareGetListParameters() : array<string|int, mixed>
- query() : Query
- Creates and returns the Query object for the entity
- setCurrentDeletingObject() : void
- setDefaultScope() : Query
- unserializeAssignedById() : array<string|int, mixed>
- unsetEntity() : mixed
- update() : UpdateResult
- Updates row in entity table by primary key
- updateMulti() : UpdateResult
- updateUserFieldValues() : Result
- wakeUpCollection() : null
- wakeUpObject() : null
Constants
DEFAULT_SORT
public
mixed
DEFAULT_SORT
= 1000
EVENT_ON_ADD
public
mixed
EVENT_ON_ADD
= "OnAdd"
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.
Tags
Return values
AddResult —Contains ID of inserted row
addMulti()
public
static addMulti(mixed $rows[, bool $ignoreEvents = false ]) : AddResult
Parameters
- $rows : mixed
- $ignoreEvents : bool = false
Tags
Return values
AddResultcheckFields()
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>
cleanCache()
Cleans the tablet cache after data modifications.
public
static cleanCache() : void
createCollection()
public
final static createCollection() : null
Tags
Return values
null —Actual type should be annotated by orm:annotate
createObject()
public
final static createObject([bool $setDefaultValues = true ]) : null
Parameters
- $setDefaultValues : bool = true
Tags
Return values
null —Actual type should be annotated by orm:annotate
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
booldelete()
Deletes row in entity table by primary key
public
static delete(mixed $primary) : DeleteResult
Parameters
- $primary : mixed
Tags
Return values
DeleteResultdeleteUserFieldValues()
public
static deleteUserFieldValues(int $id) : Result
Parameters
- $id : int
Return values
ResultdisableUserFieldsCheck()
This method disabled check that required user fields are not empty for the next saving (no matter, add or update).
public
static disableUserFieldsCheck() : void
This check will be disabled only once. You should invoke this method before every saving.
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) : Result
Parameters
- $id : mixed
-
Primary key of the entity
Tags
Return values
ResultgetByPrimary()
Returns selection by entity's primary key and optional parameters for getList()
public
static getByPrimary(mixed $primary[, array<string|int, mixed> $parameters = array() ]) : Result
Parameters
- $primary : mixed
-
Primary key of the entity
- $parameters : array<string|int, mixed> = array()
-
Additional parameters for getList()
Tags
Return values
ResultgetCollectionClass()
Returns class of Object collection for current entity.
public
static getCollectionClass() : string|Collection
Return values
string|CollectiongetCollectionClassName()
Returns class name (without namespace) of Object collection for current entity.
public
final static getCollectionClassName() : string
Return values
stringgetCollectionParentClass()
public
static getCollectionParentClass() : Collection|string
Return values
Collection|stringgetConnectionName()
Returns connection name for entity
public
static getConnectionName() : string
Return values
stringgetCount()
Performs COUNT query on entity and returns the result.
public
static getCount([mixed $filter = [] ][, array<string|int, mixed> $cache = [] ]) : int
Parameters
- $filter : mixed = []
- $cache : array<string|int, mixed> = []
-
An array of cache options "ttl" => integer indicating cache TTL
Return values
intgetDefaultCategoryId()
public
static getDefaultCategoryId() : int|null
Return values
int|nullgetDefaultStageId()
public
static getDefaultStageId() : string|null
Return values
string|nullgetEntity()
Returns entity object
public
static getEntity() : Entity
Tags
Return values
EntitygetEntityClass()
public
static getEntityClass() : Entity|string
Return values
Entity|stringgetFactory()
public
static getFactory() : Factory|null
Return values
Factory|nullgetFieldsContextDataClass()
public
static getFieldsContextDataClass() : string
Return values
stringgetFullTextDataClass()
public
static getFullTextDataClass() : string|PrototypeItemIndex
Tags
Return values
string|PrototypeItemIndexgetFullTextReferenceField()
public
static getFullTextReferenceField() : Reference
Return values
ReferencegetItemUserFieldEntityId()
public
static getItemUserFieldEntityId() : string|null
Return values
string|nullgetList()
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 = [] ]) : 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
ResultgetMap()
Returns entity map definition.
public
static getMap() : array<string|int, Field>
Return values
array<string|int, Field>getObjectClass()
Returns class of Object for current entity.
public
static getObjectClass() : string|EntityObject
Return values
string|EntityObjectgetObjectClassName()
Returns class name (without namespace) of Object for current entity.
public
final static getObjectClassName() : string
Return values
stringgetObjectParentClass()
public
static getObjectParentClass() : EntityObject|string
Return values
EntityObject|stringgetOwnFieldNames()
Returns list of field names that are not user fields.
public
static getOwnFieldNames() : array<string|int, mixed>
Return values
array<string|int, mixed>getQueryClass()
public
static getQueryClass() : Query|string
Return values
Query|stringgetRow()
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
Return values
array<string|int, mixed>|nullgetRowById()
Returns one row (or null) by entity's primary key
public
static getRowById(mixed $id) : array<string|int, mixed>|null
Parameters
- $id : mixed
-
Primary key of the entity
Tags
Return values
array<string|int, mixed>|nullgetTableName()
Returns DB table name for entity
public
static getTableName() : string
Return values
stringgetTitle()
public
static getTitle() : string|null
Return values
string|nullgetType()
public
static getType() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetUfId()
public
static getUfId() : mixed
getUserFieldValues()
public
static getUserFieldValues(int $id, array<string|int, mixed> $userFields) : array<string|int, mixed>|null
Parameters
- $id : int
- $userFields : array<string|int, mixed>
Return values
array<string|int, mixed>|nullisCacheable()
You can disable cache for the tablet completely.
public
static isCacheable() : bool
Return values
boolisOwnField()
public
static isOwnField(string $fieldName) : bool
Parameters
- $fieldName : string
Return values
boolisUtm()
public
static isUtm() : mixed
isUts()
public
static isUts() : mixed
onAdd()
public
static onAdd(Event $event) : mixed
Parameters
- $event : Event
onAfterAdd()
public
static onAfterAdd(Event $event) : EventResult
Parameters
- $event : Event
Return values
EventResultonAfterDelete()
public
static onAfterDelete(Event $event) : EventResult
Parameters
- $event : Event
Return values
EventResultonAfterUpdate()
public
static onAfterUpdate(Event $event) : EventResult
Parameters
- $event : Event
Return values
EventResultonBeforeAdd()
public
static onBeforeAdd(Event $event) : EventResult
Parameters
- $event : Event
Return values
EventResultonBeforeDelete()
public
static onBeforeDelete(Event $event) : EventResult
Parameters
- $event : Event
Return values
EventResultonBeforeUpdate()
public
static onBeforeUpdate(Event $event) : EventResult
Parameters
- $event : Event
Return values
EventResultonDelete()
public
static onDelete(Event $event) : mixed
Parameters
- $event : Event
onUpdate()
public
static onUpdate(Event $event) : mixed
Parameters
- $event : Event
postInitialize()
public
static postInitialize(Entity $entity) : null
Parameters
- $entity : Entity
Return values
nullprepareGetListParameters()
public
static prepareGetListParameters([array<string|int, mixed> $parameters = [] ]) : array<string|int, mixed>
Parameters
- $parameters : array<string|int, mixed> = []
Return values
array<string|int, mixed>query()
Creates and returns the Query object for the entity
public
static query() : Query
Tags
Return values
QuerysetCurrentDeletingObject()
public
static setCurrentDeletingObject(EntityObject $object) : void
Parameters
- $object : EntityObject
setDefaultScope()
public
static setDefaultScope(Query $query) : Query
Parameters
- $query : Query
Return values
QueryunserializeAssignedById()
public
static unserializeAssignedById(mixed $value) : array<string|int, mixed>
Parameters
- $value : mixed
Return values
array<string|int, mixed>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
Return values
UpdateResultupdateMulti()
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
Return values
UpdateResultupdateUserFieldValues()
public
static updateUserFieldValues(int $id, array<string|int, mixed> $fields) : Result
Parameters
- $id : int
- $fields : array<string|int, mixed>
Return values
ResultwakeUpCollection()
public
final static wakeUpCollection(mixed $rows) : null
Parameters
- $rows : mixed
Tags
Return values
null —Actual type should be annotated by orm:annotate
wakeUpObject()
public
final static wakeUpObject(mixed $row) : null
Parameters
- $row : mixed
Tags
Return values
null —Actual type should be annotated by orm:annotate