Errors with NodeOrderManager::selectNodes() function

Created on 5 June 2023, about 1 year ago
Updated 15 April 2024, 2 months ago

Context

- Drupal 9.5.9
- nodeorder 2.0
- PHP 8.1

Goal

What I want : Fetching ordered nodes list with NodeOrderManager
Here's a sample of my code :

$nodes = $this->nodeOrderManager->selectNodes($searchTids, 'or', 1, TRUE, 'n.sticky DESC, n.created DESC', $count = -1);

Errors

- line 181 : id() is not a function. In Drupal 9 the loadTree function takes a last parameter that is FALSE by default. If TRUE the function will load the Drupal entity, but that is not the case here which means the id() function can't be used. It should be $value->tid.

$term = $this->termStorage->load($tid);
$tree = $this->termStorage->loadTree($term->bundle(), $tid, $depth);
$descendant_tids[] = array_merge([$tid], array_map(function ($value) {
     return $value->id();
}, $tree));

- line 187 : Call to undefined function Drupal\nodeorder\db_placeholders()
- line 212 : Call to undefined function Drupal\nodeorder\pager_query()

These two I think are long deprecated.
I'm not sure if it's a major bug or not because I can always work around it and do the query without the service.

Thank you for your hard work :)

๐Ÿ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024