<?php
 namespace Modules\RemoteData\AutocompleteFieldData\ImportedSupplierSuggestions; class Controller extends \App\Mvc\ControllerAbstract { protected function initialize() { parent::initialize(); $this->actionsCfg['index'] = ['checkSection' => false, 'checkOption' => false,]; } protected function actionIndex($R) { $impServEnt = \Entity\ImportedService::select($R['idImportedService']); $impServObj = $impServEnt->object; $impOffObj = $impServObj->chosenOffer; $impOrderSupplier = $impOffObj->supplier; $matches = $impOrderSupplier->getPopulatedMatchObject($impServObj->idSystem); $matches->search(); $suggestionsArr = $matches->getAll(); $suppliersSuggestion = []; foreach ($suggestionsArr as $id=>$results) { $supplier = \Entity\Supplier::select($id); $suppliersSuggestion[] = [ 'alias' => $supplier->alias, 'id' => $supplier->getId(), 'codes' => $supplier->codeIata, ]; } $view = new View_Index($this); $view->addInput('suggestionsList', $suppliersSuggestion); $view->setOutputVar('target', $R['targetElement']); $view->setOutputVar('idImportedService', $R['idImportedService']); $view->setOutputVar('idSupplier', $R['idSupplier']); return new \Engine\Mvc\Response\Html($view->render()); } } 