Skip to main content
Version: 5.2

WrappedEntity <T, PK>

Index

Constructors

constructor

  • new WrappedEntity<T, PK>(entity: T, pkGetter?: (e: T) => Primary<T>, pkSerializer?: (e: T) => string, pkGetterConverted?: (e: T) => Primary<T>): WrappedEntity<T, PK>
  • Type parameters

    Parameters

    • entity: T
    • optionalpkGetter: (e: T) => Primary<T>
    • optionalpkSerializer: (e: T) => string
    • optionalpkGetterConverted: (e: T) => Primary<T>

    Returns WrappedEntity<T, PK>

Properties

__data

__data: Dictionary<any> = {}

optional__em

optional__identifier

__identifier?: EntityIdentifier

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

__initialized

__initialized: boolean = true

optional__lazyInitialized

__lazyInitialized?: boolean

__loadedProperties

__loadedProperties: Set<string> = ...

optional__managed

__managed?: boolean

optional__onLoadFired

__onLoadFired?: boolean

optional__originalEntityData

__originalEntityData?: EntityData<T>

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

optional__populated

__populated?: boolean

optional__schema

__schema?: string

__serializationContext

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

Type declaration

__touched

__touched: boolean = false

Accessors

__meta

__platform

__primaryKeys

Methods

[custom]

  • [custom](): string
  • Returns string

assign

getPrimaryKey

  • getPrimaryKey(convertCustomTypes?: boolean): null | Primary<T>
  • Parameters

    • convertCustomTypes: boolean = false

    Returns null | Primary<T>

getPrimaryKeys

  • getPrimaryKeys(convertCustomTypes?: boolean): null | Primary<T>[]
  • Parameters

    • convertCustomTypes: boolean = false

    Returns null | Primary<T>[]

getSchema

  • getSchema(): undefined | string
  • Returns undefined | string

getSerializedPrimaryKey

  • getSerializedPrimaryKey(): string
  • Returns string

hasPrimaryKey

  • hasPrimaryKey(): boolean
  • Returns boolean

init

  • Type parameters

    Parameters

    Returns Promise<T>

isInitialized

  • isInitialized(): boolean
  • Returns boolean

isTouched

  • isTouched(): boolean
  • Returns boolean

populated

  • populated(populated?: boolean): void
  • Parameters

    • populated: boolean = true

    Returns void

setPrimaryKey

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

    Returns void

setSchema

  • setSchema(schema?: string): void
  • Parameters

    • optionalschema: string

    Returns void

toJSON

toObject

  • Parameters

    • ignoreFields: string[] = []

    Returns EntityData<T>

toPOJO

toReference