Skip to main content
Version: Next

LoadableEntity

The load() / loadOrFail() methods added by the Loadable mixin. Declared as an interface so the mixin function can have an explicit return type (required by JSR fast-check).

Index

Methods

load

  • load<Entity, Hint, Fields, Excludes>(options): Promise<null | Loaded<Entity, Hint, Fields, Excludes>>
  • Ensures this entity is loaded (without reloading it if it already is). Returns the entity, or null if it was not found in the database (e.g. it was deleted in the meantime, or active filters disallow loading it). Use loadOrFail() if you want an error to be thrown in such a case.


    Parameters

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

loadOrFail

  • loadOrFail<Entity, Hint, Fields, Excludes>(options): Promise<Loaded<Entity, Hint, Fields, Excludes>>
  • Ensures this entity is loaded (without reloading it if it already is). Returns the entity, or throws an error just like em.findOneOrFail() (and respects the same config options) if it was not found.


    Parameters

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

Page Options