Function
typeForRelationship (name, store) Model public
Module:
@ember-data/model
Defined in ../packages/model/src/-private/model.ts:1149
- name
- String
the name of the relationship
- store
- Store
an instance of Store
- returns
- Model
the type of the relationship, or undefined
For a given relationship name, returns the model type of the relationship.
For example, if you define a model like this:
app/models/post.js
import Model, { hasMany } from '@ember-data/model';
export default class PostModel extends Model {
@hasMany('comment') comments;
}
Calling store.modelFor('post').typeForRelationship('comments', store)
will return Comment
.