Skip to main content
Version: 6.1

WrappedEntity <Entity>

Index

Constructors

constructor

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

    • Entity: object

    Parameters

    • entity: Entity
    • hydrator: IHydrator
    • optionalpkGetter: (e: Entity) => Primary<Entity>
    • optionalpkSerializer: (e: Entity) => string
    • optionalpkGetterConverted: (e: Entity) => Primary<Entity>

    Returns WrappedEntity<Entity>

Properties

__data

__data: Dictionary

optional__em

optional__identifier

__identifier?: EntityIdentifier

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

__initialized

__initialized: boolean

__loadedProperties

__loadedProperties: Set<string>

optional__managed

__managed?: boolean

optional__onLoadFired

__onLoadFired?: boolean

optional__originalEntityData

__originalEntityData?: EntityData<Entity>

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

optional__pk

__pk?: Primary<Entity>

stores last known primary key, as its current state might be broken due to propagation/orphan removal, but we need to know the PK to be able t remove the entity

optional__populated

__populated?: boolean

__processing

__processing: boolean

optional__reference

__reference?: Reference<Entity>

holds the reference wrapper instance (if created), so we can maintain the identity on reference wrappers too

optional__schema

__schema?: string

__serializationContext

__serializationContext: { fields?: string[]; populate?: PopulateOptions<Entity>[]; root?: SerializationContext<Entity> }

Type declaration

__touched

__touched: boolean

Accessors

__config

__meta

__platform

__primaryKeys

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

Methods

assign

getPrimaryKey

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

    • convertCustomTypes: boolean = false

    Returns null | Primary<Entity>

getPrimaryKeys

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

    • convertCustomTypes: boolean = false

    Returns null | Primary<Entity>[]

getSchema

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

getSerializedPrimaryKey

  • getSerializedPrimaryKey(): string
  • Returns string

hasPrimaryKey

  • hasPrimaryKey(): boolean
  • Returns boolean

init

  • init<Hint, Fields, Excludes>(options?: FindOneOptions<Entity, Hint, Fields, Excludes>): Promise<null | Loaded<Entity, Hint, Fields, Excludes>>
  • Type parameters

    • Hint: string = never
    • Fields: string = *
    • Excludes: string = never

    Parameters

    Returns Promise<null | Loaded<Entity, Hint, Fields, Excludes>>

isInitialized

  • isInitialized(): boolean
  • Returns boolean

isManaged

  • isManaged(): boolean
  • Returns boolean

isTouched

  • isTouched(): boolean
  • Returns boolean

populate

  • Type parameters

    • Hint: string = never

    Parameters

    Returns Promise<Loaded<Entity, Hint>>

populated

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

    • populated: undefined | boolean = true

    Returns void

serialize

  • Type parameters

    • Hint: string = never
    • Exclude: string = never

    Parameters

    Returns EntityDTO<Loaded<Entity, Hint>>

setPrimaryKey

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

    Returns void

setSchema

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

    • optionalschema: string

    Returns void

toJSON

toObject

  • toObject<Ignored>(ignoreFields?: Ignored[]): Omit<EntityDTO<Entity>, Ignored>
  • Type parameters

    • Ignored: string = never

    Parameters

    • optionalignoreFields: Ignored[]

    Returns Omit<EntityDTO<Entity>, Ignored>

toPOJO

toReference