Skip to main content
Version: 4.4

Interface: LoadedCollection<T, P>#

core.LoadedCollection

Type parameters#

NameTypeDefault
TAnyEntity<T>-
P-never

Hierarchy#

Properties#

$

$: readonly T & P[]

Defined in: packages/core/src/typings.ts:384


_count#

Protected Optional _count: undefined | number

Inherited from: Collection._count

Defined in: packages/core/src/entity/ArrayCollection.ts:13


initialized#

Protected initialized: boolean= true

Inherited from: Collection.initialized

Defined in: packages/core/src/entity/ArrayCollection.ts:12


items#

Protected Readonly items: Set<T>

Inherited from: Collection.items

Defined in: packages/core/src/entity/ArrayCollection.ts:11


owner#

Readonly owner: Partial<unknown> & { __@EntityRepositoryType@41631?: unknown ; __@PrimaryKeyType@41543?: unknown ; __helper?: undefined | IWrappedEntityInternal<unknown, never, never> ; __meta?: undefined | EntityMetadata<unknown> ; __platform?: undefined | Platform }

Inherited from: Collection.owner

Accessors#

length#

length(): number

Returns: number

Defined in: packages/core/src/entity/ArrayCollection.ts:134


property#

property(): EntityProperty<T>

internal

Returns: EntityProperty<T>

Defined in: packages/core/src/entity/ArrayCollection.ts:147

Methods#

[Symbol.iterator]#

[Symbol.iterator](): IterableIterator<T>

Returns: IterableIterator<T>

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:138


add#

add(...items: (T | Reference<T>)[]): void

Parameters:#

NameType
...items(T | Reference<T>)[]

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:91


contains#

contains(item: T | Reference<T>, check?: boolean): boolean

Parameters:#

NameTypeDefault value
itemT | Reference<T>-
checkbooleantrue

Returns: boolean

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:134


count#

count(): number

Returns: number

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:142


get#

get(): readonly T & P[]

Returns: readonly T & P[]

Defined in: packages/core/src/typings.ts:385


getIdentifiers#

getIdentifiers<U>(field?: string): U[]

Type parameters:#

NameTypeDefault
UIPrimaryKeyValuePrimary<T\> & string \

Parameters:#

NameType
field?string

Returns: U[]

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:53


getItems#

getItems(check?: boolean): T[]

Returns the items (the collection must be initialized)

Parameters:#

NameTypeDefault value
checkbooleantrue

Returns: T[]

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:75


getSnapshot#

getSnapshot(): undefined | T[]

internal

Returns: undefined | T[]

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:226


hydrate#

hydrate(items: T[]): void

internal

Parameters:#

NameType
itemsT[]

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:116


incrementCount#

ProtectedincrementCount(value: number): void

Parameters:#

NameType
valuenumber

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:197


init#

init(options?: InitOptions<T>): Promise<LoadedCollection<T, P>>

Parameters:#

NameType
options?InitOptions<T>

Returns: Promise<LoadedCollection<T, P>>

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:164

init(populate?: string[], where?: { __@PrimaryKeyType@41543?: any } | NonNullable<Query<T>>, orderBy?: QueryOrderMap): Promise<LoadedCollection<T, P>>

Parameters:#

NameType
populate?string[]
where?{ __@PrimaryKeyType@41543?: any } | NonNullable<Query<T>>
orderBy?QueryOrderMap

Returns: Promise<LoadedCollection<T, P>>

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:165


isDirty#

isDirty(): boolean

Returns: boolean

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:156


isInitialized#

isInitialized(fully?: boolean): boolean

Parameters:#

NameTypeDefault value
fullybooleanfalse

Returns: boolean

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:126


loadCount#

loadCount(refresh?: boolean): Promise<number>

Gets the count of collection items from database instead of counting loaded items. The value is cached, use refresh = true to force reload it.

Parameters:#

NameTypeDefault value
refreshbooleanfalse

Returns: Promise<number>

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:54


loadItems#

loadItems(): Promise<T[]>

Initializes the collection and returns the items

Returns: Promise<T[]>

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:42


populated#

populated(populated?: boolean): void

Parameters:#

NameTypeDefault value
populatedbooleantrue

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:151


propagate#

Protectedpropagate(item: T, method: add | remove): void

Parameters:#

NameType
itemT
methodadd | remove

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:157


propagateToInverseSide#

ProtectedpropagateToInverseSide(item: T, method: add | remove): void

Parameters:#

NameType
itemT
methodadd | remove

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:165


propagateToOwningSide#

ProtectedpropagateToOwningSide(item: T, method: add | remove): void

Parameters:#

NameType
itemT
methodadd | remove

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:173


remove#

remove(...items: (T | Reference<T>)[]): void

Parameters:#

NameType
...items(T | Reference<T>)[]

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:122


removeAll#

removeAll(): void

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:113


set#

set(items: (T | Reference<T>)[]): void

Parameters:#

NameType
items(T | Reference<T>)[]

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:98


setDirty#

setDirty(dirty?: boolean): void

Parameters:#

NameTypeDefault value
dirtybooleantrue

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:160


shouldPopulate#

shouldPopulate(): boolean

Returns: boolean

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:147


shouldPropagateToCollection#

ProtectedshouldPropagateToCollection(collection: ArrayCollection<unknown, T>, method: add | remove): boolean

Parameters:#

NameType
collectionArrayCollection<unknown, T>
methodadd | remove

Returns: boolean

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:184


takeSnapshot#

takeSnapshot(): void

internal

Returns: void

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:218


toArray#

toArray(): Dictionary<any>[]

Returns: Dictionary<any>[]

Inherited from: Collection

Defined in: packages/core/src/entity/ArrayCollection.ts:38


toJSON#

toJSON(): Dictionary<any>[]

Returns: Dictionary<any>[]

Inherited from: Collection

Defined in: packages/core/src/entity/Collection.ts:83

Last updated on by renovate[bot]