Skip to main content
Version: 4.5

Class: EntityLoader#

core.EntityLoader

Constructors#

constructor#

+ new EntityLoader(em: EntityManager<IDatabaseDriver<Connection>>): EntityLoader

Parameters:#

NameType
emEntityManager<IDatabaseDriver<Connection>>

Returns: EntityLoader

Defined in: packages/core/src/entity/EntityLoader.ts:25

Properties#

driver#

Private Readonly driver: IDatabaseDriver<Connection>

Defined in: packages/core/src/entity/EntityLoader.ts:25


metadata#

Private Readonly metadata: MetadataStorage

Defined in: packages/core/src/entity/EntityLoader.ts:24

Methods#

buildFields#

PrivatebuildFields<T>(prop: EntityProperty<T>, options: Required<Options<T>>): string[]

Type parameters:#

Name
T

Parameters:#

NameType
propEntityProperty<T>
optionsRequired<Options<T>>

Returns: string[]

Defined in: packages/core/src/entity/EntityLoader.ts:306


expandNestedPopulate#

PrivateexpandNestedPopulate<T>(entityName: string, parts: string[], strategy?: LoadStrategy): PopulateOptions<T>

Expands books.perex like populate to use children array instead of the dot syntax

Type parameters:#

Name
T

Parameters:#

NameType
entityNamestring
partsstring[]
strategy?LoadStrategy

Returns: PopulateOptions<T>

Defined in: packages/core/src/entity/EntityLoader.ts:117


filterCollections#

PrivatefilterCollections<T>(entities: T[], field: keyof T, refresh: boolean): T[]

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entitiesT[]
fieldkeyof T
refreshboolean

Returns: T[]

Defined in: packages/core/src/entity/EntityLoader.ts:344


filterReferences#

PrivatefilterReferences<T>(entities: T[], field: keyof T, refresh: boolean): T[keyof T][]

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entitiesT[]
fieldkeyof T
refreshboolean

Returns: T[keyof T][]

Defined in: packages/core/src/entity/EntityLoader.ts:352


findChildren#

PrivatefindChildren<T>(entities: T[], prop: EntityProperty<any>, populate: PopulateOptions<T>, options: Required<Options<T>>): Promise<AnyEntity<any>[]>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entitiesT[]
propEntityProperty<any>
populatePopulateOptions<T>
optionsRequired<Options<T>>

Returns: Promise<AnyEntity<any>[]>

Defined in: packages/core/src/entity/EntityLoader.ts:211


findChildrenFromPivotTable#

PrivatefindChildrenFromPivotTable<T>(filtered: T[], prop: EntityProperty<T>, options: Required<Options<T>>, orderBy?: QueryOrderMap, populate?: PopulateOptions<T>): Promise<AnyEntity<any>[]>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
filteredT[]
propEntityProperty<T>
optionsRequired<Options<T>>
orderBy?QueryOrderMap
populate?PopulateOptions<T>

Returns: Promise<AnyEntity<any>[]>

Defined in: packages/core/src/entity/EntityLoader.ts:276


getChildReferences#

PrivategetChildReferences<T>(entities: T[], prop: EntityProperty<T>, refresh: boolean): AnyEntity<any>[]

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entitiesT[]
propEntityProperty<T>
refreshboolean

Returns: AnyEntity<any>[]

Defined in: packages/core/src/entity/EntityLoader.ts:327


initializeCollections#

PrivateinitializeCollections<T>(filtered: T[], prop: EntityProperty<any>, field: keyof T, children: AnyEntity<any>[]): void

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
filteredT[]
propEntityProperty<any>
fieldkeyof T
childrenAnyEntity<any>[]

Returns: void

Defined in: packages/core/src/entity/EntityLoader.ts:180


initializeManyToMany#

PrivateinitializeManyToMany<T>(filtered: T[], children: AnyEntity<any>[], prop: EntityProperty<any>, field: keyof T): void

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
filteredT[]
childrenAnyEntity<any>[]
propEntityProperty<any>
fieldkeyof T

Returns: void

Defined in: packages/core/src/entity/EntityLoader.ts:204


initializeOneToMany#

PrivateinitializeOneToMany<T>(filtered: T[], children: AnyEntity<any>[], prop: EntityProperty<any>, field: keyof T): void

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
filteredT[]
childrenAnyEntity<any>[]
propEntityProperty<any>
fieldkeyof T

Returns: void

Defined in: packages/core/src/entity/EntityLoader.ts:190


lookupAllRelationships#

PrivatelookupAllRelationships<T>(entityName: string, prefix?: string, visited?: string[]): PopulateOptions<T>[]

Type parameters:#

Name
T

Parameters:#

NameTypeDefault value
entityNamestring-
prefixstring''
visitedstring[]-

Returns: PopulateOptions<T>[]

Defined in: packages/core/src/entity/EntityLoader.ts:362


lookupEagerLoadedRelationships#

PrivatelookupEagerLoadedRelationships<T>(entityName: string, populate: PopulateOptions<T>[], prefix?: string, visited?: string[]): PopulateOptions<T>[]

Type parameters:#

Name
T

Parameters:#

NameTypeDefault value
entityNamestring-
populatePopulateOptions<T>[]-
prefixstring''
visitedstring[]-

Returns: PopulateOptions<T>[]

Defined in: packages/core/src/entity/EntityLoader.ts:388


mergeNestedPopulate#

PrivatemergeNestedPopulate<T>(populate: PopulateOptions<T>[]): PopulateOptions<T>[]

merge multiple populates for the same entity with different children

Type parameters:#

Name
T

Parameters:#

NameType
populatePopulateOptions<T>[]

Returns: PopulateOptions<T>[]

Defined in: packages/core/src/entity/EntityLoader.ts:89


normalizePopulate#

normalizePopulate<T>(entityName: string, populate: true | PopulateOptions<T>[], lookup?: boolean): PopulateOptions<T>[]

Type parameters:#

Name
T

Parameters:#

NameTypeDefault value
entityNamestring-
populatetrue | PopulateOptions<T>[]-
lookupbooleantrue

Returns: PopulateOptions<T>[]

Defined in: packages/core/src/entity/EntityLoader.ts:58


populate#

populate<T>(entityName: string, entities: T[], populate: boolean | PopulateOptions<T>[], options: Options<T>): Promise<void>

Loads specified relations in batch. This will execute one query for each relation, that will populate it on all of the specified entities.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
entitiesT[]
populateboolean | PopulateOptions<T>[]
optionsOptions<T>

Returns: Promise<void>

Defined in: packages/core/src/entity/EntityLoader.ts:32


populateField#

PrivatepopulateField<T>(entityName: string, entities: T[], populate: PopulateOptions<T>, options: Required<Options<T>>): Promise<void>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
entitiesT[]
populatePopulateOptions<T>
optionsRequired<Options<T>>

Returns: Promise<void>

Defined in: packages/core/src/entity/EntityLoader.ts:244


populateMany#

PrivatepopulateMany<T>(entityName: string, entities: T[], populate: PopulateOptions<T>, options: Required<Options<T>>): Promise<AnyEntity<any>[]>

preload everything in one call (this will update already existing references in IM)

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
entitiesT[]
populatePopulateOptions<T>
optionsRequired<Options<T>>

Returns: Promise<AnyEntity<any>[]>

Defined in: packages/core/src/entity/EntityLoader.ts:133

Last updated on by Renovate Bot