I'm having some problem when I want to create a many-to-many association. because he does not know. I am trying to create a relationship this way. but I'm not sure. can anyone help me? How can I do it?. here is my code
Ext.define('Ext4Example.model.Category', { extend : 'Ext.data.Model', alias : 'widget.categoryModel', idProperty: 'id', fields: [ {name:'id', mapping:'id', type:'int'}, {name:'name', mapping:'name', type:'string'} ], proxy: { type: 'ajax', noCache: false, api: { create : '${createLink(controller:'category', action: 'create')}', read : '${createLink(controller:'category', action: 'read')}', update : '${createLink(controller:'category', action: 'update')}', destroy : '${createLink(controller:'category', action: 'destroy')}' }, actionMethods: { create : 'POST', read : 'GET', update : 'PUT', destroy : 'DELETE' }, reader: { type : 'json', root : 'data', totalProperty : 'total', successProperty : 'success', messageProperty : 'message', implicitIncludes: true }, writer: { type : 'json', root : 'data', writeAllFields: true }, simpleSortMode: true }, hasMany: [{model: 'Manufacturer', name: 'manufacturers'}]
});
Second model here
Ext.define('Ext4Example.model.Manufacturer', { extend : 'Ext.data.Model', alias : 'widget.manufacturerModel', idProperty: 'id', fields: [ {name:'id', mapping:'id', type:'int'}, {name:'name', mapping:'name', type:'string'} ], proxy: { type: 'ajax', noCache: false, api: { create : '${createLink(controller:'manufacturer', action: 'create')}', read : '${createLink(controller:'manufacturer', action: 'read')}', update : '${createLink(controller:'manufacturer', action: 'update')}', destroy : '${createLink(controller:'manufacturer', action: 'destroy')}' }, actionMethods: { create : 'POST', read : 'GET', update : 'PUT', destroy : 'DELETE' }, reader: { type : 'json', root : 'data', totalProperty : 'total', successProperty : 'success', messageProperty : 'message', implicitIncludes: true }, writer: { type : 'json', root : 'data', writeAllFields: true }, simpleSortMode: true }, hasMany: [{model: 'Category', name: 'categories'}]
});