LoadedReference <T>
Hierarchy
- Reference<NonNullable<T>>
- LoadedReference
Index
Properties
$
Methods
get
Returns NonNullable<T>
inheritedgetEntity
Returns the underlying entity, throwing an error if the reference is not initialized.
Returns NonNullable<T>
inheritedgetProperty
Returns the value of a property on the underlying entity. Throws if the reference is not initialized.
Parameters
prop: K
Returns NonNullable<T>[K]
inheritedisInitialized
Returns whether the underlying entity has been fully loaded from the database.
Returns boolean
inheritedload
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.Parameters
options: LoadReferenceOptions<TT, P, F, E> = {}
Returns Promise<null | Loaded<TT, P, F, E>>
inheritedloadOrFail
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).Parameters
options: LoadReferenceOrFailOptions<TT, P, F, E> = {}
Returns Promise<Loaded<TT, P, F, E>>
inheritedloadProperty
Loads the entity if needed, then returns the value of the specified property.
Parameters
prop: K
optionaloptions: LoadReferenceOrFailOptions<TT, P, *, never>
Returns Promise<Loaded<TT, P>[K]>
inheritedpopulated
Marks the underlying entity as populated or not for serialization purposes.
Parameters
optionalpopulated: boolean
Returns void
inheritedtoJSON
Serializes the underlying entity to a plain JSON object.
Parameters
rest...args: any[]
Returns Dictionary
inheritedunwrap
Returns the underlying entity without checking initialization state.
Returns NonNullable<T>
A
Reference<T>that is guaranteed to be loaded, providing synchronous access via$andget().