1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Calling Models

Discussion in 'Development Tutorials [Archive]' started by ragtek, May 28, 2011.

  1. ragtek

    ragtek Guest

    (my english is horrible and i'm not a author, so it's a minimalistic text;)

    Even some Coders are using this, you should NEVER use
    $foo = new ModelName;
    to create model instances!
    If you do it this way, your model instances won't be using the xenforo plugin system (proxy classes)
    which could cause problems

    This are the ways how to call a model:

    From Controller:
    $foo $this->getModelFromCache('ModelName');
    From Model
    $foo $this->getModelFromCache('ModelName');
    From all other parts:
    $foo XenForo_Model::create('ModelName');
    bottiger, ceribik, Hoffi and 3 others like this.
  2. KozmoK

    KozmoK Active Member


    I hate to dirty up your post with this stupid question! Can I call a 3rd party (already a working add-on) model from within another controller, or model?
    I'm going to edit the paypalProcessor to call my custom model and do a db function.


  3. Bob

    Bob Well-Known Member

  4. Liam O'Neill

    Liam O'Neill New Member

    ANyone tell me where I can find a list of models and the functions within, specifically need to access user data from an external script
  5. Hoffi

    Hoffi Well-Known Member

    Directory library/XenForo/Model
  6. ragtek

    ragtek Guest

    I would suggest to search for a good PHP IDE and to learn how to use it;)

    XF_Model_User diagramm:

    Hope this helps;)

    Or you could use http://www.phpdoc.org/ or an alternative to get a nice API documentation

Share This Page