Hi

I have two models Location and File defined. Location has a reference to parent Location. Is this the right way to define a parent->children like relation in models?



Code:



Ext.define('CB.model.File', {
extend: 'CB.model.Base',

fields: [
{name: 'locationId', reference: 'Location'},
{name: 'name', type: 'string'},
{name: 'fileName', type: 'string'},
{name: 'extension', type: 'string'}
...
]
});


Ext.define('CB.model.Location', {
extend: 'CB.model.Base',

clientIdProperty: 'clientId',


fields: [
{name: 'parentId', reference: {type: 'Location', role: 'parent', inverse: 'children'}},
{name: 'countryId', reference: 'Country', unique: true},
{name: 'name', type: 'string'},
{name: 'description', type: 'string'}
...
]
});

I load all the data in a nested way, and it works. But when I do session.getSaveBatch(); I get this error.

Uncaught Error: Location has circular foreign-key references: File --> Location --> Location


I dont know if this is a bug or not ...