<?php
 namespace App\ReportsData\EntityFields; class ImportedDocument extends \App\ReportsData\EntityFields\GeneralAbstract { protected function getDbTableName() { global $DBTRd_importedDocs; return $DBTRd_importedDocs; } protected function getCustomValues($fieldName) { switch ($fieldName) { case 'externalSystem': return new ImportedDocumentSystem($this->values['idExternalSystem']); case 'customer': return new Customer($this->values['idCustomer']); case 'corporate': return new Corporate($this->values['idCorporate']); case 'supplier': return new Supplier($this->values['idSupplier']); case 'agencyBankAccount': return new AgencyBankAccount($this->values['idAgencyBankAccount']); case 'user': return new User($this->values['idUser']); case 'office': return new Office($this->values['idOffice']); case 'issueUser': return new User($this->values['idIssueUser']); case 'addUser': return new User($this->values['idAddUser']); case 'updateUser': return new User($this->values['idUpdateUser']); case 'documentsList': { $docListObj = new \App\ReportsData\EntityList\Documents(); $docListObj->setColumns(['docType', 'idTemplate', 'idDocSeries', 'format', 'docNumber', 'docDate', 'generation', 'preview', 'idAutoProcessRule']); $docListObj->setFilter('pivot', '=', 'importedDocument'); $docListObj->setFilter('idPivot', '=', $this->getId()); $docListObj->setOrderBy('id', 'ASC'); $docsList = $docListObj->exportRecords(); $this->values[$fieldName] = array_combine(array_column($docsList, 'id'), $docsList); return $this->values[$fieldName]; } default: return parent::getCustomValues($fieldName); } } protected function processDefaultValues() { $this->values['idDocumentsTina'] = $this->values['idDocumentsTina'] ? json_decode($this->values['idDocumentsTina'], true) : []; $this->values['extraInfo'] = $this->values['extraInfo'] ? json_decode($this->values['extraInfo'], true) : []; } } 