Results 1 to 3 of 3

Thread: How to access a model in another schema?

  1. #1
    Ext JS Premium Member
    Join Date
    Jul 2011
    Location
    Atlanta
    Posts
    39
    Answers
    2
    Vote Rating
    7
      0  

    Default Answered: How to access a model in another schema?

    Let's take an example app. I have a common module with a bunch of models. They all use the default Schema.
    I have 2 other modules billing and inventory. They have their own schema. Each transaction creates a session and the schema representing that module is attached to the session.


    Code:
    \app
    +---billing
    |   \---model
    |           Base.js
    |           Customer.js
    |           Order.js
    |
    +---common
    |   \---model
    |           Base.js
    |           Policy.js
    |           User.js
    |
    \---inventory
        \---model
                Base.js
                Item.js
                Location.js

    In my billing view model, when I reference an entityName (Customer) it looks it up in the billing schema attached to the current session.

    I saw the ticket app where all the models are placed under one schema, but that's not a viable option in my case. Each module will internally have sub modules with their own models and such.

    So is there a way to access the Item model from the inventory schema or Policy model from the default schema in the billing view model?

    There is no association between models across schemas. I just need to load models from another schema to populate a combo box or things like that. Those models will not be mutated (only reads).

  2. What do you mean by:

    access the Item model from the inventory schema
    You can just specify the full model name if you want to use it in a store.

  3. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,196
    Answers
    753
    Vote Rating
    1002
      0  

    Default

    What do you mean by:

    access the Item model from the inventory schema
    You can just specify the full model name if you want to use it in a store.
    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.

  4. #3
    Ext JS Premium Member
    Join Date
    Jul 2011
    Location
    Atlanta
    Posts
    39
    Answers
    2
    Vote Rating
    7
      0  

    Default

    The session in the billing view model is using the billing schema. If I want to create an items store in the billing view model using the Item model (which is part of the inventory schema), all I have to do is specify it with the fully qualified name (Example.inventory.model.Item)?

    Thought I tried this and it didn't work. Must have goofed up elsewhere.

    Thanks Evan!

Posting Permissions

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