LPH
Well-known member
What is the best way to call getModelFromCache from an external file? The file is connected via a bridge.
Right now I plugged in the getModelFromCache method (copied from XenForo_Model.php) into the connector between WordPress and XenForo. I
And call from a $xenword variable.
However, I'm not sure to even tell whether or not this makes any difference from simply using create and the class separately each time.
Right now I plugged in the getModelFromCache method (copied from XenForo_Model.php) into the connector between WordPress and XenForo. I
PHP:
public function getModelFromCache($class)
{
if (!isset($this->_modelCache[$class]))
{
$this->_modelCache[$class] = XenForo_Model::create($class);
}
return $this->_modelCache[$class];
}
And call from a $xenword variable.
PHP:
$xenword_options = get_option( 'xenword_options' );
$xenword = new XenWord ( $xenword_options );
/** @var $sessionModel XenForo_Model_Session */
$sessionModel = $xenword->getModelFromCache('XenForo_Model_Session');
However, I'm not sure to even tell whether or not this makes any difference from simply using create and the class separately each time.