<?php
namespace App\Form\Input; class Autocomplete_Data_SupplierBankAccount extends \Engine\Form\Input\Autocomplete_Data_GeneralAbstract { protected $minLength = 0; protected function getPageResultsBulk() :array { $suppliersBankAccountsListObj = new \App\EntityList\SupplierBankAccounts(); $suppliersBankAccountsListObj->applyUserRestriction(false); $suppliersBankAccountsListObj->setColumns(['suppBankAccounts.account', 'suppBankAccounts.currency', 'banks.bankName']); $suppliersBankAccountsListObj->setFilter('suppBankAccounts.account', 'LIKE', "{$this->searchString}%"); if ($this->filters['idSupplier']) { $suppliersBankAccountsListObj->setFilter('suppBankAccounts.idSupplier', 'LIKE', $this->filters['idSupplier']); } $suppliersBankAccountsListObj->setOrderBy('suppBankAccounts.account', 'ASC'); $suppliersBankAccountsListObj->setLimit($this->offset, $this->resultsCountPage); return $this->executeSqlEntityList($suppliersBankAccountsListObj); } protected function getPageResultsFormatted(Array $pageResults) { $list = []; foreach ($pageResults as $row) { $extra = $row['bankName']; if ($row['currency']) { $extra.=" [".$row['currency']."]"; } $list[] = $this->getCleanItem($row['id'], $row['account'], $extra, ''); } return $list; } }