• 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

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');
 

KozmoK

Active member
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
 

Bob

Well-known member
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
 

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
 
R

ragtek

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


XF_Model_User diagramm:
diagram.png

Hope this helps;)

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