XF 2.0 How do I access Thread->FirstPost->Message on thread creation?

Jaxel

Well-known member
I am trying to do the following in the THREAD entity:
Code:
    protected function _postSave()
    {
        \XF::dump($this->FirstPost->message);
    
        return parent::_postSave();
    }

Unfortunately, on thread creation, this returns the following error:
[E_NOTICE] Trying to get property of non-object

How do I get the contents of the first post's message on _postSave?
 
You might be better extending the Thread creator service for this. That has access to the first post.
 
Top Bottom