Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ID field for has many associations #29

Open
danschultz opened this issue Mar 26, 2013 · 0 comments
Open

Support ID field for has many associations #29

danschultz opened this issue Mar 26, 2013 · 0 comments
Labels

Comments

@danschultz
Copy link
Owner

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant