Skip to main content
Version: 4.5

Class: WrappedEntity<T, PK>#

core.WrappedEntity

Type parameters#

NameType
TAnyEntity<T>
PKkeyof T

Constructors#

constructor#

+ new WrappedEntity<T, PK>(entity: T, pkGetter: (e: T) => Primary<T>, pkSerializer: (e: T) => string): WrappedEntity<T, PK>

Type parameters:#

NameType
TAnyEntity<T>
PKstring | number | symbol

Parameters:#

NameType
entityT
pkGetter(e: T) => Primary<T>
pkSerializer(e: T) => string

Returns: WrappedEntity<T, PK>

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

Properties#

__em#

Optional __em: EntityManager<IDatabaseDriver<Connection>>

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


__identifier#

Optional __identifier: EntityIdentifier

holds wrapped primary key so we can compute change set without eager commit

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


__initialized#

__initialized: boolean= true

Defined in: packages/core/src/entity/WrappedEntity.ts:14


__lazyInitialized#

Optional __lazyInitialized: boolean

Defined in: packages/core/src/entity/WrappedEntity.ts:16


__managed#

Optional __managed: boolean

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


__originalEntityData#

Optional __originalEntityData: EntityData<T>

holds last entity data snapshot so we can compute changes when persisting managed entities

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


__populated#

Optional __populated: boolean

Defined in: packages/core/src/entity/WrappedEntity.ts:15


__serializationContext#

__serializationContext: object

Type declaration:#

NameType
populate?PopulateOptions<T>[]
root?SerializationContext<T>

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

Accessors#

__meta#

• get __meta(): EntityMetadata<T>

Returns: EntityMetadata<T>

Defined in: packages/core/src/entity/WrappedEntity.ts:94


__platform#

• get __platform(): Platform

Returns: Platform

Defined in: packages/core/src/entity/WrappedEntity.ts:98


__primaryKeyCond#

• get __primaryKeyCond(): null | Primary<T> | Primary<T>[]

Returns: null | Primary<T> | Primary<T>[]

Defined in: packages/core/src/entity/WrappedEntity.ts:106


__primaryKeys#

• get __primaryKeys(): Primary<T>[]

Returns: Primary<T>[]

Defined in: packages/core/src/entity/WrappedEntity.ts:102

Methods#

[custom]#

[custom](): string

Returns: string

Defined in: packages/core/src/entity/WrappedEntity.ts:114


assign#

assign(data: EntityData<T>, options?: AssignOptions): T

Parameters:#

NameType
dataEntityData<T>
options?AssignOptions

Returns: T

Defined in: packages/core/src/entity/WrappedEntity.ts:57


getPrimaryKey#

getPrimaryKey(): null | Primary<T>

Returns: null | Primary<T>

Defined in: packages/core/src/entity/WrappedEntity.ts:82


getSerializedPrimaryKey#

getSerializedPrimaryKey(): string

Returns: string

Defined in: packages/core/src/entity/WrappedEntity.ts:90


hasPrimaryKey#

hasPrimaryKey(): boolean

Returns: boolean

Defined in: packages/core/src/entity/WrappedEntity.ts:77


init#

init<P>(populated?: boolean, populate?: P, lockMode?: LockMode): Promise<T>

Type parameters:#

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

Parameters:#

NameTypeDefault value
populatedbooleantrue
populate?P-
lockMode?LockMode-

Returns: Promise<T>

Defined in: packages/core/src/entity/WrappedEntity.ts:65


isInitialized#

isInitialized(): boolean

Returns: boolean

Defined in: packages/core/src/entity/WrappedEntity.ts:31


populated#

populated(populated?: boolean): void

Parameters:#

NameTypeDefault value
populatedbooleantrue

Returns: void

Defined in: packages/core/src/entity/WrappedEntity.ts:35


setPrimaryKey#

setPrimaryKey(id: null | Primary<T>): void

Parameters:#

NameType
idnull | Primary<T>

Returns: void

Defined in: packages/core/src/entity/WrappedEntity.ts:86


toJSON#

toJSON(...args: any[]): { [P in string | number | symbol]?: any} & Dictionary<any>

Parameters:#

NameType
...argsany[]

Returns: { [P in string | number | symbol]?: any} & Dictionary<any>

Defined in: packages/core/src/entity/WrappedEntity.ts:52


toObject#

toObject(ignoreFields?: string[]): EntityData<T>

Parameters:#

NameType
ignoreFieldsstring[]

Returns: EntityData<T>

Defined in: packages/core/src/entity/WrappedEntity.ts:44


toPOJO#

toPOJO(): EntityData<T>

Returns: EntityData<T>

Defined in: packages/core/src/entity/WrappedEntity.ts:48


toReference#

toReference(): IdentifiedReference<T, PK>

Returns: IdentifiedReference<T, PK>

Defined in: packages/core/src/entity/WrappedEntity.ts:40

Last updated on by Renovate Bot