Cylon
Member
Dear friends,
I'm developing an Addon, that expands the XF rest Api with some endpoints that I need for the client app that I'm developing.
For example, I'm missing in the official rest API an endpoint to mark a thread as read, because of that I'm writing myself endpoint.
I searched across the source code and found that the function that marks a thread as read lives in the XenForo_Model_Thread class, and that this class is instantiated in the following way:
That's the source code that I'm using in my custom controller, in my custom endpoint. My custom controller extends the class XF\Api\Controller\Thread and it is working very well (for the other endpoints that I implemented).
But when calling, \XenForo_Model::create( "XenForo_Model_Thread" ), the following exception happens: "Class 'XenForo_Application' not found"
As said in another thread, I'm newbie to the Xenforo development, and I'm pretty sure that I'm missing something. I read the docus available again, especially all related to the autoload features, but I did not find what I'm doing wrong.
Do I have to require some PHP classes in my custom endpoints to access the XF framework? Or maybe am I extending the wrong class for my custom endpoint?
Thanks in advance and excuse my poor English.
Cylon
I'm developing an Addon, that expands the XF rest Api with some endpoints that I need for the client app that I'm developing.
For example, I'm missing in the official rest API an endpoint to mark a thread as read, because of that I'm writing myself endpoint.
I searched across the source code and found that the function that marks a thread as read lives in the XenForo_Model_Thread class, and that this class is instantiated in the following way:
Code:
/* @var $threadModel \XenForo_Model_Thread */
$threadModel = \XenForo_Model::create( "XenForo_Model_Thread" );
$threadModel->markThreadRead();
That's the source code that I'm using in my custom controller, in my custom endpoint. My custom controller extends the class XF\Api\Controller\Thread and it is working very well (for the other endpoints that I implemented).
But when calling, \XenForo_Model::create( "XenForo_Model_Thread" ), the following exception happens: "Class 'XenForo_Application' not found"
As said in another thread, I'm newbie to the Xenforo development, and I'm pretty sure that I'm missing something. I read the docus available again, especially all related to the autoload features, but I did not find what I'm doing wrong.
Do I have to require some PHP classes in my custom endpoints to access the XF framework? Or maybe am I extending the wrong class for my custom endpoint?
Thanks in advance and excuse my poor English.
Cylon