RelationCollection extends Collection
Tags
Table of Contents
Constants
- COMMON_FIELDS = ['ID', 'MESSAGE_TYPE', 'CHAT_ID', 'USER_ID', 'START_ID', 'LAST_FILE_ID', 'LAST_ID', 'LAST_SEND_MESSAGE_ID', 'UNREAD_ID', 'NOTIFY_BLOCK', 'MANAGER', 'REASON']
Methods
- __construct() : mixed
- add() : static
- Append collection with new item.
- createFake() : self
- delete() : Result
- Delete from the database all entities that are in the registry and have an id
- filter() : $this
- filterActive() : self
- filterNotifySubscribed() : self
- find() : static
- getAny() : T|null
- getByUserId() : Relation|null
- getCollectionElementClass() : string|ActiveRecord
- Returns collection item's class name.
- getDataClass() : string|DataManager
- Returns ORM tablet class name.
- getDataEntityCollection() : Collection
- Before external call, call prepare method to update the state of the entity @see BaseLinkCollection::prepareFields()
- getPrimaryIds() : array<string|int, int>
- getStartId() : int
- getUserIds() : array<string|int, mixed>
- getUsers() : UserCollection
- hasUnsaved() : bool
- hasUser() : bool
- load() : Result
- Restores object state from database.
- merge() : static
- offsetGet() : Relation
- offsetSet() : void
- Alias to add method.
- offsetUnset() : mixed
- onAfterRelationDelete() : void
- save() : Result
- Saves collection objects states into database.
- unsetByKeys() : void
Constants
COMMON_FIELDS
public
mixed
COMMON_FIELDS
= ['ID', 'MESSAGE_TYPE', 'CHAT_ID', 'USER_ID', 'START_ID', 'LAST_FILE_ID', 'LAST_ID', 'LAST_SEND_MESSAGE_ID', 'UNREAD_ID', 'NOTIFY_BLOCK', 'MANAGER', 'REASON']
Methods
__construct()
public
__construct([mixed $source = null ]) : mixed
Parameters
- $source : mixed = null
add()
Append collection with new item.
public
add(ActiveRecord $entry) : static
Parameters
- $entry : ActiveRecord
Tags
Return values
staticcreateFake()
public
static createFake(array<string|int, mixed> $userIds, Chat $chat) : self
Parameters
- $userIds : array<string|int, mixed>
- $chat : Chat
Return values
selfdelete()
Delete from the database all entities that are in the registry and have an id
public
delete() : Result
Return values
Resultfilter()
public
filter(callable $predicate) : $this
Parameters
- $predicate : callable
Return values
$thisfilterActive()
public
filterActive() : self
Return values
selffilterNotifySubscribed()
public
filterNotifySubscribed() : self
Return values
selffind()
public
static find(array<string|int, mixed> $filter[, array<string|int, mixed> $order = [] ][, int|null $limit = null ][, Context|null $context = null ][, array<string|int, mixed> $select = self::COMMON_FIELDS ]) : static
Parameters
- $filter : array<string|int, mixed>
- $order : array<string|int, mixed> = []
- $limit : int|null = null
- $context : Context|null = null
- $select : array<string|int, mixed> = self::COMMON_FIELDS
Return values
staticgetAny()
public
getAny() : T|null
Return values
T|nullgetByUserId()
public
getByUserId(int $userId, int $chatId) : Relation|null
Parameters
- $userId : int
- $chatId : int
Return values
Relation|nullgetCollectionElementClass()
Returns collection item's class name.
public
static getCollectionElementClass() : string|ActiveRecord
Return values
string|ActiveRecordgetDataClass()
Returns ORM tablet class name.
public
final static getDataClass() : string|DataManager
Return values
string|DataManagergetDataEntityCollection()
Before external call, call prepare method to update the state of the entity @see BaseLinkCollection::prepareFields()
public
getDataEntityCollection() : Collection
Return values
CollectiongetPrimaryIds()
public
getPrimaryIds() : array<string|int, int>
Return values
array<string|int, int>getStartId()
public
static getStartId(int $userId, int $chatId) : int
Parameters
- $userId : int
- $chatId : int
Return values
intgetUserIds()
public
getUserIds() : array<string|int, mixed>
Return values
array<string|int, mixed>getUsers()
public
getUsers() : UserCollection
Return values
UserCollectionhasUnsaved()
public
hasUnsaved() : bool
Return values
boolhasUser()
public
hasUser(int $userId, int $chatId) : bool
Parameters
- $userId : int
- $chatId : int
Return values
boolload()
Restores object state from database.
public
load(array<string|int, int>|array<string|int, mixed>|Collection $source) : Result
Parameters
- $source : array<string|int, int>|array<string|int, mixed>|Collection
Return values
Resultmerge()
public
merge(Registry<string|int, T> $registry) : static
Parameters
- $registry : Registry<string|int, T>
Return values
staticoffsetGet()
public
offsetGet(mixed $key) : Relation
Parameters
- $key : mixed
Return values
RelationoffsetSet()
Alias to add method.
public
offsetSet(mixed $key, mixed $value) : void
Parameters
- $key : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $key) : mixed
Parameters
- $key : mixed
onAfterRelationDelete()
public
onAfterRelationDelete(int $chatId, int $userId) : void
Parameters
- $chatId : int
- $userId : int
save()
Saves collection objects states into database.
public
save([bool $isGroupSave = false ]) : Result
Parameters
- $isGroupSave : bool = false
Return values
ResultunsetByKeys()
public
unsetByKeys(array<string|int, mixed> $keys) : void
Parameters
- $keys : array<string|int, mixed>