XF 2.0 XF:Post and XF:Thread Relation


Active member
I am working on a news add-on and can't seem to figure out something basic.

This code below gets me this error: "LogicException: Unknown relation XF:Thread accessed on xf_post in src/XF/Mvc/Entity/Finder.php at line 630"

If I exclude XF:Thread then it works fine, but I need the thread title, so I got to have that in there. I've checked XF:post and it has a relation with XF:Thread

$finder = \XF::finder('XF:Post');
$news = $finder->with('XF:Thread')->where('post_id',$post_id)->fetchOne();
So what did I do wrong?

edit: $post_id is 1 FWIW
Last edited:


Well-known member
The relationship name is "Thread", which points to an entity called "XF:Thread".

aka the correct code should be;
$finder = \XF::finder('XF:Post');
$news = $finder->with('Thread')->where('post_id',$post_id)->fetchOne();