Adding Extrafield of type Dropdownlost DB (multiple options) to PDF

I am currently setting up the interventions module. For our usecase, we need to know who did the intervention, as multiple people can do one intervention and we need to know how many were involved.
So I added a new extrafied of type Dropdownlist DB (multiple options) in the module options with following db select:

user:CONCAT(firstname, ' ', lastname):rowid::

this works great and I can now select the Users that did the intervention.

The problem occurs when I try to print these names on the PDF.
first I tried to get the name as I did with other extrafields:

$outputlangs->convToOutputCharset($object->array_options['options_users']);

But this only prints

3, 2

on the pdf, But I need the names. So I found this article and the section Special Case for Extrafields type “Select list”
So I tried to get the names like this:

require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
[...]
$extrafields = new ExtraFields($this->db);
$extrafields->showOutputField('users', $object->array_options['options_users'], '', $object->table_element)

But this only results in multiple errors when creating the pdf:

**Warning**: Undefined array key "fichinter" in **C:\xampp\htdocs\dolibarr_stable\htdocs\core\class\extrafields.class.php** on line **1908**

**Warning**: Trying to access array offset on value of type null in **C:\xampp\htdocs\dolibarr_stable\htdocs\core\class\extrafields.class.php** on line **1908**

**Warning**: Trying to access array offset on value of type null in **C:\xampp\htdocs\dolibarr_stable\htdocs\core\class\extrafields.class.php** on line **1908**

The PDF is created fine after that. But the names are not available to print. So how can I get the names to print on the PDF?

For anyone interested, I was able to get the involved usernames like this:

// contains the rowid values of selected users as comma separated string
$users = $outputlangs->convToOutputCharset($object->array_options['options_techniker']);
$names = [];
if($users ) {
  $userIds = explode(',', $users);
  // require the user class, set needed globals
  require_once (DOL_DOCUMENT_ROOT."/user/class/user.class.php");
  global $langs;
  // fetch user from DB for each ID
  foreach($userIds as $userId) {
    $user = new User($this->db);
    $user->fetch($userId);
    // push username to the array
    array_push($names, $user->getFullName($langs));
  }
}
// print the names array on the pdf as comma separated list
$pdf->Cell(0, 0, implode(', ', $names));

The process should be very similar for any other database entity that we add as extrafields.

  1. Iterate over the IDs
  2. load the required file for the entity class
  3. fetch the rows from the database
  4. get the needed information from these entites