<?php
 namespace App\Form\Input; class Autocomplete_OfficeAndUser extends Autocomplete_GeneralAbstract { protected $class = "autocomplete"; public function getUrl() { return ($this->url?:\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/AutocompleteFieldData', '', ['class'=>'OfficeAndUser'])); } public function getValue() { $v = parent::getValue(); if ($v==='|') { $v = ''; } return $v; } public function determineDisplayValue($displayId) :string { if ($displayId) { list($idOffice, $idUser) = explode('|', $displayId); if ($idUser) { return (string)\Entity\User::select($idUser)->name; } else { return (string)\Entity\Office::select($idOffice)->name; } } return ''; } } 