home
  • Blog
  • Home
  • Projects
    • Ember
    • EmberData
    • Ember CLI
2.18
  • Packages
    • ember-data
  • Classes
    • DS.AbortError
    • DS.Adapter
    • DS.AdapterError
    • DS.AdapterPopulatedRecordArray
    • DS.BelongsToReference
    • DS.BooleanTransform
    • DS.BuildURLMixin
    • DS.ConflictError
    • DS.DateTransform
    • DS.EmbeddedRecordsMixin
    • DS.Errors
    • DS.FilteredRecordArray
    • DS.ForbiddenError
    • DS.HasManyReference
    • DS.InvalidError
    • DS.JSONAPIAdapter
    • DS.JSONAPISerializer
    • DS.JSONSerializer
    • DS.ManyArray
    • DS.Model
    • DS.NotFoundError
    • DS.NumberTransform
    • DS.PromiseArray
    • DS.PromiseManyArray
    • DS.PromiseObject
    • DS.RESTAdapter
    • DS.RESTSerializer
    • DS.RecordArray
    • DS.RecordReference
    • DS.RootState
    • DS.Serializer
    • DS.ServerError
    • DS.Store
    • DS.StringTransform
    • DS.TimeoutError
    • DS.Transform
    • DS.UnauthorizedError
    • Ember.Inflector

Class RelationshipPayloads private


Defined in: addon/-private/system/relationships/relationship-payloads.js:37
Module: ember-data

Manages the payloads for both sides of a single relationship, across all model instances.

For example, with

const User = DS.Model.extend({ hobbies: DS.hasMany('hobby') });

const Hobby = DS.Model.extend({ user: DS.belongsTo('user') });

let relationshipPayloads = new RelationshipPayloads('user', 'hobbies', 'hobby', 'user');

let userPayload = { data: { id: 1, type: 'user', relationships: { hobbies: { data: [{ id: 2, type: 'hobby', }] } } } };

// here we expect the payload of the individual relationship relationshipPayloads.push('user', 1, 'hobbies', userPayload.data.relationships.hobbies);

relationshipPayloads.get('user', 1, 'hobbies'); relationshipPayloads.get('hobby', 2, 'user');


Methods

_isLHS : Boolean

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:141

returns
Boolean

true iff modelName and relationshipName refer to the left hand side of this relationship, as opposed to the right hand side.

_isRHS : Boolean

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:161

returns
Boolean

true iff modelName and relationshipName refer to the right hand side of this relationship, as opposed to the left hand side.

_removeFromInverse

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:381

Remove id from its inverse record with id inverseId. If the inverse relationship is a belongsTo, this means just setting it to null, if the inverse relationship is a hasMany, then remove that id from its array of ids.

_removeInverse

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:350

Remove the relationship in previousPayload from its inverse(s), because this relationship payload has just been updated (eg because the same relationship had multiple payloads pushed before the relationship was initialized).

get

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:93

Get the payload for the relationship of an individual record.

This might return the raw payload as pushed into the store, or one computed from the payload of the inverse relationship.

push

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:112

Push a relationship payload for an individual record.

This will make the payload available later for both this relationship and its inverse.

unload

Module: ember-data

Defined in addon/-private/system/relationships/relationship-payloads.js:123

Unload the relationship payload for an individual record.

This does not unload the inverse relationship payload.

On this page


Methods

  • _isLHS
  • _isRHS
  • _removeFromInverse
  • _removeInverse
  • get
  • push
  • unload
Team Sponsors Security Legal Branding Community Guidelines
Twitter GitHub Discord Mastodon

If you want help you can contact us by email, open an issue, or get realtime help by joining the Ember Discord.

© Copyright 2026 - Tilde Inc.
Ember.js is free, open source and always will be.


Ember is generously supported by
blue Created with Sketch.