#
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: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:Name | Type |
---|---|
...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:Name | Type | Default value |
---|---|---|
item | T | Reference<T> | - |
check | boolean | true |
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:Name | Type | Default |
---|---|---|
U | IPrimaryKeyValue | Primary<T\> & string \ |
#
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: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:Name | Type |
---|---|
items | T[] |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:116
#
incrementCountâ–¸ Protected
incrementCount(value
: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/ArrayCollection.ts:197
#
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:164
â–¸ init(populate?
: string[], where?
: { __@PrimaryKeyType@41543?
: any } | NonNullable<Query<T>>, orderBy?
: QueryOrderMap): Promise<LoadedCollection<T, P>>
#
Parameters:Name | Type |
---|---|
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:Name | Type | Default value |
---|---|---|
fully | boolean | false |
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:Name | Type | Default value |
---|---|---|
refresh | boolean | false |
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:Name | Type | Default value |
---|---|---|
populated | boolean | true |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:151
#
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:157
#
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:165
#
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:173
#
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: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:Name | Type |
---|---|
items | (T | Reference<T>)[] |
Returns: void
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:98
#
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:160
#
shouldPopulateâ–¸ shouldPopulate(): boolean
Returns: boolean
Inherited from: Collection
Defined in: packages/core/src/entity/Collection.ts:147
#
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: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