I upgraded my application from Sencha Touch 2.4 to ExtJs 6.5.3.
On Sencha Touch 2.4, there is a function for the Association (Ext.data.association.Association) by the name of getType() that returns the association-type as a string, for example: "hasOne".
as seen for example, in here (the Model source code of Sencha Touch 2.4):
for (i = 0; i < associationCount; i++) {
association = associations[i];
associationName = association.getName();
type = association.getType();
allow = true;
if (associationType) {
allow = type == associationType;
}
if (allow && type.toLowerCase() == 'hasmany') {
In my project, by understanding if the association type is hasmany, hasone or belongsto I can "choose" what type of SQL query to create (not originally written by me, but that's a large project and I can't contact the original developer), so that's a must for me.
I try to look into the Extjs 6 / 6.5 documentation and couldn't find anything. Seems like it was deprecated a long time ago.
I was thinking about inserting the "type" inside the model as an object of models and types, for example:
{
'MyProject.model.Receipt': 'hasone',
'MyProject.model.Order': 'hasmany',
'MyProject.model.invoice': 'belongsto',
...
}
and then try to access it from the model itself and find the type by the association "parent" model.
It feels like a risk and an overkill for such a (suppose-to-be) easy task.
I tried to also find online for solutions but it looks like no one ever tried to find a solution for something like that.
Thank you