Skip to main content
Version: 6.2

LoadedReference <T>

Hierarchy

Index

Properties

$

$: Defined<T>

Methods

get

  • get(): Defined<T>
  • Returns Defined<T>

getEntity

  • getEntity(): Defined<T>
  • Returns Defined<T>

getProperty

  • getProperty<K>(prop: K): Defined<T>[K]
  • Type parameters

    • K: string | number | symbol

    Parameters

    • prop: K

    Returns Defined<T>[K]

isInitialized

  • isInitialized(): boolean
  • Returns boolean

load

  • Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns the entity. If the entity is not found in the database (e.g. it was deleted in the meantime, or currently active filters disallow loading of it) the method returns null. Use loadOrFail() if you want an error to be thrown in such a case.


    Type parameters

    • TT: {}
    • P: string = never
    • F: string = *
    • E: string = never

    Parameters

    Returns Promise<null | Loaded<TT, P, F, E>>

loadOrFail

  • Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns the entity or throws an error just like em.findOneOrFail() (and respects the same config options).


    Type parameters

    • TT: {}
    • P: string = never
    • F: string = *
    • E: string = never

    Parameters

    Returns Promise<Loaded<TT, P, F, E>>

loadProperty

  • Type parameters

    • TT: {}
    • P: string = never
    • K: string | number | symbol = keyof TT

    Parameters

    Returns Promise<Loaded<TT, P>[K]>

populated

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

    • optionalpopulated: boolean

    Returns void

toJSON

  • Parameters

    • rest...args: any[]

    Returns Dictionary

unwrap

  • unwrap(): Defined<T>
  • Returns Defined<T>