Version: 4.3

Class: EntityLoader

Hierarchy

  • EntityLoader

Constructors

constructor

+ new EntityLoader(em: EntityManager): EntityLoader

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

Parameters:

NameType
emEntityManager

Returns: EntityLoader

Properties

driver

Private Readonly driver: IDatabaseDriver<Connection> = this.em.getDriver()

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


em

Private Readonly em: EntityManager

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


metadata

Private Readonly metadata: MetadataStorage = this.em.getMetadata()

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

Methods

expandNestedPopulate

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

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

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>


filterCollections

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entitiesT[]
fieldkeyof T
refreshboolean

Returns: T[]


filterReferences

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entitiesT[]
fieldkeyof T
refreshboolean

Returns: T[keyof T][]


findChildren

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<AnyEntity[]>


findChildrenFromPivotTable

PrivatefindChildrenFromPivotTable<T>(filtered: T[], prop: EntityProperty, field: keyof T, refresh: boolean, where?: FilterQuery<T>, orderBy?: QueryOrderMap): Promise<AnyEntity[]>

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
filteredT[]
propEntityProperty
fieldkeyof T
refreshboolean
where?FilterQuery<T>
orderBy?QueryOrderMap

Returns: Promise<AnyEntity[]>


getChildReferences

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entitiesT[]
propEntityProperty<T>
refreshboolean

Returns: AnyEntity[]


initializeCollections

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
filteredT[]
propEntityProperty
fieldkeyof T
childrenAnyEntity[]

Returns: void


initializeManyToMany

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
filteredT[]
childrenAnyEntity[]
propEntityProperty
fieldkeyof T

Returns: void


initializeOneToMany

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
filteredT[]
childrenAnyEntity[]
propEntityProperty
fieldkeyof T

Returns: void


lookupAllRelationships

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

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

Type parameters:

Name
T

Parameters:

NameTypeDefault value
entityNamestring-
prefixstring""
visitedstring[][]

Returns: PopulateOptions<T>[]


lookupEagerLoadedRelationships

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

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

Type parameters:

Name
T

Parameters:

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

Returns: PopulateOptions<T>[]


mergeNestedPopulate

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

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

merge multiple populates for the same entity with different children

Type parameters:

Name
T

Parameters:

NameType
populatePopulateOptions<T>[]

Returns: PopulateOptions<T>[]


normalizePopulate

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

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

Type parameters:

Name
T

Parameters:

NameTypeDefault value
entityNamestring-
populatePopulateOptions<T>[] | true-
lookupbooleantrue

Returns: PopulateOptions<T>[]


populate

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

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

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[]
populatePopulateOptions<T>[] | boolean
optionsOptions<T>

Returns: Promise<void>


populateField

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

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<void>


populateMany

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

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

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[]>

Last updated on by Martin Adámek