来自LoopBack documentation:
当两个模型之间存在关系时(参见Creating model relations),LoopBack会自动创建一组与为关系定义的API路径相对应的相关模型方法。
在以下列表中, modelName 是相关模型的名称, modelNamePlural 是相关模型名称的复数形式。
<强>属于关联:强>
<强> hasOne:强>
- __ create__relatedModelName
- __ get__relatedModelName
- __ update__relatedModelName
- __ destroy__relatedModelName
<强>的hasMany:强>
- __ count__relatedModelNamePlural
- __ create__relatedModelNamePlural
- __ delete__relatedModelNamePlural
- __ destroyById__relatedModelNamePlural
- __ findById__relatedModelNamePlural
- __ get__relatedModelNamePlural
- __ updateById__relatedModelNamePlural
<强> hasManyThrough:强>
- __ count__relatedModelNamePlural
- __ create__relatedModelNamePlural
- __ delete__relatedModelNamePlural
- __ destroyById__relatedModelNamePlural
- __ exists__relatedModelNamePlural(仅通过)
- __ findById__relatedModelNamePlural
- __ get__relatedModelNamePlural
- __ link__relatedModelNamePlural(仅限通过)
- __ updateById__relatedModelNamePlural
- __ unlink__relatedModelNamePlural(仅限通过)
<强> hasAndBelongsToMany:强>
- __ link__relatedModelNamePlural
- __ unlink__relatedModelNamePlural