#
Interface: LoadedCollection<T, P>core.LoadedCollection
#
Type parametersName | Type | Default |
---|---|---|
T | AnyEntity<T> | - |
P | - | never |
#
HierarchyCollection<T>
↳ LoadedCollection
#
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:Name | Type |
---|---|
...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:Name | Type | Default value |
---|---|---|
item | T | Reference<T> | - |
check | boolean | true |
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:Name | Type | Default |
---|---|---|
U | IPrimaryKeyValue | Primary<T> & IPrimaryKeyValue |
#
Parameters:Name | Type |
---|---|
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:Name | Type | Default value |
---|---|---|
check | boolean | true |
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:Name | Type |
---|---|
items | T[] |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:143
#
incrementCountâ–¸ Protected
incrementCount(value
: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/ArrayCollection.ts:202
#
initâ–¸ init(options?
: InitOptions<T>): Promise<LoadedCollection<T, P>>
#
Parameters:Name | Type |
---|---|
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:Name | Type |
---|---|
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:Name | Type | Default value |
---|---|---|
fully | boolean | false |
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:Name | Type | Default value |
---|---|---|
refresh | boolean | false |
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:Name | Type |
---|---|
options | MatchingOptions<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:Name | Type | Default value |
---|---|---|
populated | boolean | true |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:178
#
propagateâ–¸ Protected
propagate(item
: T, method
: add | remove): void
#
Parameters:Name | Type |
---|---|
item | T |
method | add | remove |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/ArrayCollection.ts:162
#
propagateToInverseSideâ–¸ Protected
propagateToInverseSide(item
: T, method
: add | remove): void
#
Parameters:Name | Type |
---|---|
item | T |
method | add | remove |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/ArrayCollection.ts:170
#
propagateToOwningSideâ–¸ Protected
propagateToOwningSide(item
: T, method
: add | remove): void
#
Parameters:Name | Type |
---|---|
item | T |
method | add | remove |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/ArrayCollection.ts:178
#
removeâ–¸ remove(...items
: (T | Reference<T>)[]): void
#
Parameters:Name | Type |
---|---|
...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:Name | Type |
---|---|
items | (T | Reference<T>)[] |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:125
#
setDirtyâ–¸ setDirty(dirty?
: boolean): void
#
Parameters:Name | Type | Default value |
---|---|---|
dirty | boolean | true |
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â–¸ Protected
shouldPropagateToCollection(collection
: ArrayCollection<unknown, T>, method
: add | remove): boolean
#
Parameters:Name | Type |
---|---|
collection | ArrayCollection<unknown, T> |
method | add | 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