extend: 'Ext.data.Model',
requires: ['Books.model.Review', 'Ext.data.association.HasMany', 'Ext.data.association.BelongsTo'],
fields: [
'id',
'name',
'author',
'detail',
'price',
'image'
],
hasMany: {
model: 'Books.model.Review',
name: 'reviews',
foreignKey: 'book_id'
}
});
Ext.define('Books.model.Review', {
extend: 'Ext.data.Model',
requires: ['Ext.data.association.HasMany', 'Ext.data.association.BelongsTo'],
fields: [
'product_id',
'author',
'rating',
'date',
'title',
'comment'
],
belongsTo: {
model: 'Books.model.Book',
getterName: 'getBook',
setterName: 'setBook'
}
});