• 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

  • Thread starter Thread starter ragtek
  • Start date Start date
R

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
PHP:
$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:
PHP:
$foo = $this->getModelFromCache('ModelName');

From Model
PHP:
$foo = $this->getModelFromCache('ModelName');

From all other parts:
PHP:
$foo = XenForo_Model::create('ModelName');
 
Ragtek,

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.

Thanks,

Koz
 
Ragtek,

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.

Thanks,

Koz

Yes
 
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
 
I would suggest to search for a good PHP IDE and to learn how to use it;)


XF_Model_User diagramm:
diagram.webp

Hope this helps;)

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