Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Nov 2008
    Location
    Lyon, France
    Posts
    215
    Vote Rating
    5
    christophe.geiser will become famous soon enough

      0  

    Default [CLOSED]cannot extend Model having associations (PR5)

    [CLOSED]cannot extend Model having associations (PR5)


    Trying to extend User Model as below triggers a 'config.ownerModel is undefined' error. It seems that Ext.data.Association.constructor is called without config while overriding Model.

    Code:
        Ext.regModel('Post', {
            fields: ['id', 'user_id'],
            belongsTo: 'User',
            hasMany  : {model: 'Comment', name: 'comments'}
        });
        
        Ext.regModel('Comment', {
            fields: ['id', 'user_id', 'post_id'],
            belongsTo: 'Post'
        });
        
        Ext.regModel('User', {
            fields: ['id'],
            hasMany: [
                'Post',
                {model: 'Comment', name: 'comments'}
            ]
        });
        
        Ext.regModel('UserExtend',{
            extend: 'User'
        });
    Cheers
    c.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,905
    Vote Rating
    626
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    If I run your code against B1 no errors are thrown. Can you confirm?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Location
    Lyon, France
    Posts
    215
    Vote Rating
    5
    christophe.geiser will become famous soon enough

      0  

    Default


    Congrats to the team for the Beta !

    I can confirm: this problem does not persist under B1

    Cheers
    C.

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,905
    Vote Rating
    626
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    FYI there's no reason to use regModel anymore, you can extend directly:

    Code:
    Ext.define('Foo', {
        extend: 'Ext.data.Model',
        fields: ['bar', 'baz']
    });
    This means you can declare your models like any other classes.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. How to extend a Model
    By AndreaCammarata in forum Sencha Touch 1.x: Discussion
    Replies: 15
    Last Post: 31 Aug 2011, 5:16 PM
  2. Replies: 4
    Last Post: 20 Mar 2011, 8:14 PM
  3. [CLOSED][3.0rc3] Ext.extend and xtype problem?
    By netski in forum Ext 3.x: Bugs
    Replies: 2
    Last Post: 2 Jul 2009, 5:36 AM

Thread Participants: 1