Skip to main content
Version: 4.5

Class: EntityFactory#

core.EntityFactory

Constructors#

constructor#

+ new EntityFactory(unitOfWork: UnitOfWork, em: EntityManager<IDatabaseDriver<Connection>>): EntityFactory

Parameters:#

NameType
unitOfWorkUnitOfWork
emEntityManager<IDatabaseDriver<Connection>>

Returns: EntityFactory

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

Properties#

config#

Private Readonly config: Configuration<IDatabaseDriver<Connection>>

Defined in: packages/core/src/entity/EntityFactory.ts:19


driver#

Private Readonly driver: IDatabaseDriver<Connection>

Defined in: packages/core/src/entity/EntityFactory.ts:17


eventManager#

Private Readonly eventManager: EventManager

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


hydrator#

Private Readonly hydrator: IHydrator

Defined in: packages/core/src/entity/EntityFactory.ts:21


metadata#

Private Readonly metadata: MetadataStorage

Defined in: packages/core/src/entity/EntityFactory.ts:20


platform#

Private Readonly platform: Platform

Defined in: packages/core/src/entity/EntityFactory.ts:18

Methods#

create#

create<T, P>(entityName: EntityName<T>, data: EntityData<T>, options?: FactoryOptions): Loaded<T, P>

Type parameters:#

NameTypeDefault
TAnyEntity<T>-
Preadonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>any

Parameters:#

NameType
entityNameEntityName<T>
dataEntityData<T>
optionsFactoryOptions

Returns: Loaded<T, P>

Defined in: packages/core/src/entity/EntityFactory.ts:27


createEntity#

PrivatecreateEntity<T>(data: EntityData<T>, meta: EntityMetadata<T>, options: FactoryOptions): T

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
dataEntityData<T>
metaEntityMetadata<T>
optionsFactoryOptions

Returns: T

Defined in: packages/core/src/entity/EntityFactory.ts:88


createReference#

createReference<T>(entityName: EntityName<T>, id: Primary<T> | Primary<T>[] | Record<string, Primary<T>>, options?: Pick<FactoryOptions, convertCustomTypes | merge>): T

Type parameters:#

Name
T

Parameters:#

NameType
entityNameEntityName<T>
idPrimary<T> | Primary<T>[] | Record<string, Primary<T>>
optionsPick<FactoryOptions, convertCustomTypes | merge>

Returns: T

Defined in: packages/core/src/entity/EntityFactory.ts:64


denormalizePrimaryKey#

PrivatedenormalizePrimaryKey<T>(data: EntityData<T>, primaryKey: string, prop: EntityProperty<T>): void

denormalize PK to value required by driver (e.g. ObjectId)

Type parameters:#

Name
T

Parameters:#

NameType
dataEntityData<T>
primaryKeystring
propEntityProperty<T>

Returns: void

Defined in: packages/core/src/entity/EntityFactory.ts:153


extractConstructorParams#

PrivateextractConstructorParams<T>(meta: EntityMetadata<T>, data: EntityData<T>): T[keyof T][]

returns parameters for entity constructor, creating references from plain ids

Type parameters:#

Name
T

Parameters:#

NameType
metaEntityMetadata<T>
dataEntityData<T>

Returns: T[keyof T][]

Defined in: packages/core/src/entity/EntityFactory.ts:171


findEntity#

PrivatefindEntity<T>(data: EntityData<T>, meta: EntityMetadata<T>, convertCustomTypes?: boolean): undefined | T

Type parameters:#

Name
T

Parameters:#

NameType
dataEntityData<T>
metaEntityMetadata<T>
convertCustomTypes?boolean

Returns: undefined | T

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


hydrate#

Privatehydrate<T>(entity: T, meta: EntityMetadata<T>, data: EntityData<T>, options: FactoryOptions): void

Type parameters:#

Name
T

Parameters:#

NameType
entityT
metaEntityMetadata<T>
dataEntityData<T>
optionsFactoryOptions

Returns: void

Defined in: packages/core/src/entity/EntityFactory.ts:110


processDiscriminatorColumn#

PrivateprocessDiscriminatorColumn<T>(meta: EntityMetadata<T>, data: EntityData<T>): EntityMetadata<T>

Type parameters:#

Name
T

Parameters:#

NameType
metaEntityMetadata<T>
dataEntityData<T>

Returns: EntityMetadata<T>

Defined in: packages/core/src/entity/EntityFactory.ts:132

Last updated on by Renovate Bot