Skip to main content
Version: 4.5

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:390


_count#

Protected Optional _count: 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]?: unknown ; [PrimaryKeyType]?: unknown ; __helper?: IWrappedEntityInternal<unknown, never, never> ; __meta?: EntityMetadata<unknown> ; __platform?: Platform }

Inherited from: Collection.owner

Accessors#

length#

• get length(): number

Returns: number

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


property#

• get property(): EntityProperty<T>

internal

Returns: EntityProperty<T>

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

Methods#

[Symbol.iterator]#

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

Returns: IterableIterator<T>

Inherited from: Collection

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


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:118


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:161


count#

count(): number

Returns: number

Inherited from: Collection

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


get#

get(): readonly T & P[]

Returns: readonly T & P[]

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


getIdentifiers#

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

Type parameters:#

NameTypeDefault
UIPrimaryKeyValuePrimary<T> & IPrimaryKeyValue

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:102


getSnapshot#

getSnapshot(): undefined | T[]

internal

Returns: undefined | T[]

Inherited from: Collection

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


hydrate#

hydrate(items: T[]): void

internal

Parameters:#

NameType
itemsT[]

Returns: void

Inherited from: Collection

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


incrementCount#

ProtectedincrementCount(value: number): void

Parameters:#

NameType
valuenumber

Returns: void

Inherited from: Collection

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


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:191

init(populate?: string[], where?: FilterQuery<T>, orderBy?: QueryOrderMap): Promise<LoadedCollection<T, P>>

Parameters:#

NameType
populate?string[]
where?FilterQuery<T>
orderBy?QueryOrderMap

Returns: Promise<LoadedCollection<T, P>>

Inherited from: Collection

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


isDirty#

isDirty(): boolean

Returns: boolean

Inherited from: Collection

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


isInitialized#

isInitialized(fully?: boolean): boolean

Parameters:#

NameTypeDefault value
fullybooleanfalse

Returns: boolean

Inherited from: Collection

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


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:63


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:51


matching#

matching(options: MatchingOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>): Promise<T[]>

Parameters:#

NameType
optionsMatchingOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>

Returns: Promise<T[]>

Inherited from: Collection

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


populated#

populated(populated?: boolean): void

Parameters:#

NameTypeDefault value
populatedbooleantrue

Returns: void

Inherited from: Collection

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


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:162


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:170


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:178


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:149


removeAll#

removeAll(): void

Returns: void

Inherited from: Collection

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


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:125


setDirty#

setDirty(dirty?: boolean): void

Parameters:#

NameTypeDefault value
dirtybooleantrue

Returns: void

Inherited from: Collection

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


shouldPopulate#

shouldPopulate(): boolean

Returns: boolean

Inherited from: Collection

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


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:189


takeSnapshot#

takeSnapshot(): void

internal

Returns: void

Inherited from: Collection

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


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:110

Last updated on by Renovate Bot