Class HasManyReference

public

A HasManyReference is a low-level API that allows access and manipulation of a hasMany relationship.

It is especially useful when you're dealing with async relationships from @ember-data/model as it allows synchronous access to the relationship data if loaded, as well as APIs for loading, reloading the data or accessing available information without triggering a load.

It may also be useful when using sync relationships with @ember-data/model that need to be loaded/reloaded with more precise timing than marking the relationship as async and relying on autofetch would have allowed.

However,keep in mind that marking a relationship as async: false will introduce bugs into your application if the data is not always guaranteed to be available by the time the relationship is accessed. Ergo, it is recommended when using this approach to utilize links for unloaded relationship state instead of identifiers.

Reference APIs are entangled with the relationship's underlying state, thus any getters or cached properties that utilize these will properly invalidate if the relationship state changes.

References are "stable", meaning that multiple calls to retrieve the reference for a given relationship will always return the same HasManyReference.

Show:

An array of identifiers for the records that this reference refers to.

The field name on the parent record for this has-many relationship.

The type of resource this relationship will contain.