Cannot load class using XFCP. It must be simple but I just can't see it....

Marcel

Active member
Cannot load class using XFCP. Load the class using the correct loader first.

1. XenForo_Autoloader->autoload()
2. spl_autoload_call() in MaB/Arch/Model/Thread.php at line 3

Contents of MaB/Arch/Model/Thread.php
Code:
<?php
class MaB_Arch_Model_Thread extends XFCP_MaB_Arch_Model_Thread
{
	public function getArchThreads(array $conditions, array $fetchOptions = array())
	{
		$whereConditions = $this->prepareArchThreadConditions($conditions, $fetchOptions);
etc etc etc

My listener :
* Listen to Event : load_class_model
* Event Hint : None
* Execute Callback : MaB_Arch_Listener::extendModel

Contents of MaB/Arch/Listener.php
Code:
public static function extendModel($class, array &$extend) {
		if ($class == 'XenForo_Model_Thread') {
			$extend [] = 'MaB_Arch_Model_Thread';
		}
	}
	
}

I'm sure it must be something simple. I have tried adding in an event hint of "XenForo_Model_Thread", and removing the if statement from Listener.php
I've also tried changing the listener to load_class instead of load_class_model?

What am I missing?
(Incase you were wondering, my Model/Thread.php has revised versions of getThreads (getArchThreads) and prepareThreadConditions (prepareArchThreadConditions)).
 
Are you trying to access your class directly? i.e. something like $model = XenForo_Model::create("MaB_Arch_Model_Thread"); because you can't do that. You're supposed to still call $model = XenForo_Model::create("XenForo_Model_Thread"); and that will include yours which extends the original thread model.
 
Sorry for the delay in replying.
I was indeed! What a plum I am :)
Made those changes and all is well with the world again, thank you ):
 
Top Bottom