LoadedReference <T>
Hierarchy
- Reference<NonNullable<T>>
- LoadedReference
Index
Properties
$
Methods
get
Returns NonNullable<T>
getEntity
Returns NonNullable<T>
getProperty
Type parameters
- K: string | number | symbol
Parameters
prop: K
Returns NonNullable<T>[K]
isInitialized
Returns boolean
load
Type parameters
- TT: {}
- P: string = never
- F: string = *
- E: string = never
Parameters
options: LoadReferenceOptions<TT, P, F, E> = {}
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
options: LoadReferenceOrFailOptions<TT, P, F, E> = {}
Returns Promise<Loaded<TT, P, F, E>>
loadProperty
Type parameters
- TT: {}
- P: string = never
- K: string | number | symbol = keyof TT
Parameters
prop: K
optionaloptions: LoadReferenceOrFailOptions<TT, P, *, never>
Returns Promise<Loaded<TT, P>[K]>
populated
Parameters
optionalpopulated: boolean
Returns void
toJSON
Parameters
rest...args: any[]
Returns Dictionary
unwrap
Returns NonNullable<T>
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
. UseloadOrFail()
if you want an error to be thrown in such a case.