Version: 4.3

Class: WrappedEntity<T, PK>

Type parameters

NameType
TAnyEntity<T>
PKkeyof T

Hierarchy

  • WrappedEntity

Constructors

constructor

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

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

Parameters:

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

Returns: WrappedEntity

Properties

__em

Optional __em: EntityManager

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


__identifier

Optional __identifier: EntityData<T>

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

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


__initialized

__initialized: boolean = true

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


__lazyInitialized

Optional __lazyInitialized: boolean

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


__managed

Optional __managed: boolean

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


__originalEntityData

Optional __originalEntityData: EntityData<T>

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

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


__populated

Optional __populated: boolean

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


__serializationContext

__serializationContext: { populate?: PopulateOptions<T>[] ; root?: SerializationContext<T> }

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

Type declaration:

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

entity

Private Readonly entity: T

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


pkGetter

Private Readonly pkGetter: (e: T) => Primary<T>

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


pkSerializer

Private Readonly pkSerializer: (e: T) => string

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

Accessors

__meta

• get __meta(): EntityMetadata<T>

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

Returns: EntityMetadata<T>


__platform

• get __platform(): Platform

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

Returns: Platform


__primaryKeyCond

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

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

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


__primaryKeys

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

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

Returns: Primary<T>[]

Methods

[inspect.custom]

[inspect.custom](): string

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

Returns: string


assign

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

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

Parameters:

NameType
dataEntityData<T>
options?AssignOptions

Returns: T


getPrimaryKey

getPrimaryKey(): Primary<T> | null

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

Returns: Primary<T> | null


getSerializedPrimaryKey

getSerializedPrimaryKey(): string

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

Returns: string


hasPrimaryKey

hasPrimaryKey(): boolean

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

Returns: boolean


init

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

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

Type parameters:

NameTypeDefault
PPopulate<T>Populate\<T>

Parameters:

NameTypeDefault value
populatedbooleantrue
populate?P-
lockMode?LockMode-

Returns: Promise<T>


isInitialized

isInitialized(): boolean

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

Returns: boolean


populated

populated(populated?: boolean): void

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

Parameters:

NameTypeDefault value
populatedbooleantrue

Returns: void


setPrimaryKey

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

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

Parameters:

NameType
idPrimary<T> | null

Returns: void


toJSON

toJSON(...args: any[]): EntityData<T> & Dictionary

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

Parameters:

NameType
...argsany[]

Returns: EntityData<T> & Dictionary


toObject

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

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

Parameters:

NameTypeDefault value
ignoreFieldsstring[][]

Returns: EntityData<T>


toReference

toReference(): IdentifiedReference<T, PK>

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

Returns: IdentifiedReference<T, PK>

Last updated on by Martin Adámek