Marcel
Active member
PHP:
public function actionUnarchive(ParameterBag $params)
{
$thread = $this->assertViewableThread($params->thread_id);
$forum = $thread->Forum;
$currentForumId = $forum->node_id;
/** @var \XF\Repository\Node $nodeRepo */
$nodeRepo = $this->repository('XF:Node');
$nodes = $this->app()->repository('XF:Node')->findNodesForList()->fetch();
$this->app()->repository('XF:Node')->filterViewable($nodes);
$viewParams = [
'thread' => $thread,
'forum' => $forum,
'prefixes' => $forum->getUsablePrefixes(),
'nodeTree' => $nodeRepo->createNodeTree($nodes)
];
return $this->view('XF:Thread\Move', 'thread_move', $viewParams);
}
That's the function. adding a dump($nodes) to the code, shows me a full list of nodes. Great, and the dropdown menu matches this.
I want to restrict that list of forums to only those that have a particular field set in the xf_node table, so I want to add a 'where' condition to this line
$nodes = $this->app()->repository('XF:Node')->findNodesForList()->where('ut_archive_enabled','=','1')->fetch();
This gives me an 'unknown column' error. Fine. I'll step back a bit and just try and match the node_id for now.
$nodes = $this->app()->repository('XF:Node')->findNodesForList()->where('node_id','=','25')->fetch();
This doesnt throw an error, but the dropdown list on the thread_move template is empty.
However, dump($nodes) shows a restricted list of nodes which is just what I want.
However, it doesn't reflect in the template? The dropdown list is empty.
This may sound like a stupid question (I've only just stepped into rewriting my addons for XF2), but where am I going wrong?
The whole finder/entity/repository is giving my head a bit of a pickle.
Last edited: