mesh
mesh copied to clipboard
Support ID field for has many associations
Has many associations are empty until you call HasManyAssociation.load()
. This method invokes the DataSource.belongsTo()
. I think we can simplify the data source by having the backend pass back an array of record IDs for the association. When the association is accessed, it instantiates records for each of the IDs.
When HasManyAssociation.load()
is called, it will do a batch retrieve call for each of the association's records. Alternatively, you can also call load()
on each of the records to load them individually.
public class Person extends Record
{
[HasMany(idField="childrenIds", recordType="myapp.Person")]
public var children:HasManyAssociation;
public var childrenIds:Array;
}