Results 1 to 3 of 3

Thread: Association just ignored if model class not found, no warning, even in debug build

    You found a bug! We've classified it as EXTJS-15195 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,296

    Default Association just ignored if model class not found, no warning, even in debug build

    I know over the years with just the people I have worked with, we lost hours for that issue. It's insane I didn't log that bug before.

    Code below work perfectly, but if I remove the requires on Nextt.model.Option, then it will still load data, without any warning, even with the most 'debug' build of ext js, but will have no 'recollection' that we have declared association 'options'. Will show and behave like the following code is missing:
    Code:
    {
    		type : 'hasMany',
    		model : 'Nextt.model.Option',
    		name : 'options',
    		associationKey : 'transactionHeader.options'
    	}
    Remove this, break silently the association:
    Code:
    requires: ['Nextt.model.Option']
    Code:
    Ext.define('Nextt.model.Transaction', {
    	extend : 'Ext.data.Model',
    	requires: ['Nextt.model.Option'],
    	fields : [ ],
    	associations : [ {
    		type : 'hasMany',
    		model : 'Nextt.model.Interval',
    		associationKey : 'intervals',
    		name : 'intervals',
    		storeConfig : {
    			xclass : 'Nextt.store.IntervalStore'
    		}
    	}, {
    		type : 'hasMany',
    		model : 'Nextt.model.Option',
    		name : 'options',
    		associationKey : 'transactionHeader.options'
    	} ]
    });

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,253

    Default

    The problem is an issue of timing. By their nature, one class will always have to be defined before the other, so it's not possible at definition time to say "the class is missing". Pushing that out further, you could be using dynamic loading, so the class could come along at any time.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,296

    Default

    I do have warning in console when extjs proactively load a class at the last minute when using dynamic loading. I also have error, when a class is asked for but not loaded and not able to be loaded. This case is very exceptional, it fail silently. I understand if the association structure support cycle reference, at the initialization you cannot really give warning or error if a class is still not findable. But later on, like when reading/write association, that class is expected to be used, and not found, at that time an error or warning should occur.

Similar Threads

  1. Replies: 2
    Last Post: 16 Aug 2014, 2:13 PM
  2. Replies: 1
    Last Post: 13 Jun 2013, 6:36 AM
  3. Model class not found in built app
    By Qarea in forum Sencha Cmd
    Replies: 5
    Last Post: 25 Feb 2013, 9:47 AM
  4. Replies: 2
    Last Post: 10 Apr 2012, 10:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •