1. #1
    Sencha User relson's Avatar
    Join Date
    Dec 2011
    Location
    São Paulo, SP, Brasil
    Posts
    10
    Vote Rating
    1
    relson is on a distinguished road

      0  

    Lightbulb Commad Sencha Generate with namespace

    Commad Sencha Generate with namespace


    How can I do to generate model/controller with namespace like...

    Code:
    sencha generate model admin.User
    and then have a folder structure

    Code:
    /model
         |_ /admin
                    |_User.js
    on current version I have the outputed a file with dot separated admin.User.js in folder model
    Last edited by relson; 23 Mar 2012 at 9:21 AM. Reason: Formatting to let more clear

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,118
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The issue is that the folder structure doesn't adhere to the dot notation namespace but the name of the model is correct right?

    I can see the model having the right name but the path doesn't look like it supports this:

    Code:
    this.template('model.js', path.join('app', 'model', args.name + '.js'));
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    47
    Vote Rating
    1
    ruslan.talpa is on a distinguished road

      0  

    Default


    It seems like sencha CMD expects all models to be in the "model" directory and when used in store it should be like:

    model: 'ModelName' #which translates to App.model.ModelName

    so far so good, but if i want to specify the model name like this:
    model: 'App.model.ModelName'
    sencha cmd will translate this to App.model.App.model.ModelName and the file will not be found.

    This is very useful when you have multiple apps like Core, App1, App2 and App1, App2 stores use the model definitions from Core.
    While in browser this works fine, sencha cmd does not understand this.

    Is there a way around this?
    Is it possible to modify that line which generates the filepath for models? Can we dig somewhere in sencha cmd and modify it on our one so that when args.name contains a dot, consider it the full class name and not append the current applucation namespace.

    Thank you