BaseModel.appendChild() method
Attaches related data to this instance as though it had been joined in.
Signature:
appendChild(name: string, data: any): this;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
string |
Property to set, normally an association name. |
|
data |
any |
What to attach: an instance, an array of them, or anything else. |
Returns:
this
This instance, for chaining.
Remarks
Sets the property, and when a returning list is in force adds the name to it so the property survives serialization. That is the point of it: data fetched by a second query would otherwise be dropped by toJSON().