<?php
namespace Entity; class WorldspanService extends \App\Entity\GDSServiceAbstract { const systemCode = 'worldspan'; protected function setTableName(): void { global $DBTWorldspanServices; $this->tableName = $DBTWorldspanServices; } protected function getFile($idFile) { return \Entity\WorldspanFile::select($idFile); } public function getStorageObjInstance() { return \App\Worldspan\Storage\StorageHandler::getInstance(); } protected function getAttribute($var) { switch ($var) { case 'TINABookUser': return User::select($this->fields['idTINABookUser']); case 'TINAIssueUser': return User::select($this->fields['idTINAIssueUser']); case 'PNRRootService': if (!array_key_exists($var, $this->fields)) { $this->fields[$var] = $this->getAttribute_PNRRootService_using_transactionCode(); } return $this->fields[$var]; break; case 'RECLOC': return substr($this->getAttribute('transactionCode'), 0, 6); case 'PNRFiles': $ret = []; if ($this->getAttribute('RECLOC')) { $PNRServices = $this->getStorageObjInstance()->selectServiceArrFromDB([ 'transactionCode~'=> $this->getAttribute('RECLOC'), ]); foreach ($PNRServices as $ref) { $ret[$ref['idFile']] = $this->getFile($ref['idFile']); } } return array_values($ret); default: { return parent::getAttribute($var); } } } protected function setAttribute($var, $value) { switch ($var) { case 'transactionCode': case 'idWorldspanBookUser': case 'idWorldspanIssueUser': case 'idWorldspanBookOffice': case 'idWorldspanIssueOffice': case 'idTINABookUser': case 'idTINAIssueUser': case 'idTINABookOffice': case 'idTINAIssueOffice': { $this->fields[$var] = $value; break; } default: { return parent::setAttribute($var, $value); } } } } 