<?php
namespace Entity; class SabreService extends \App\Entity\GDSServiceAbstract { const systemCode = 'sabre'; protected function getFile($idFile) { return \Entity\SabreFile::select($idFile); } public function getStorageObjInstance() { return \App\Sabre\Storage\StorageHandler::getInstance(); } protected function setTableName(): void { global $DBTSabreServices; $this->tableName = $DBTSabreServices; } 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 'idSabreBookUser': case 'idSabreIssueUser': case 'idSabreBookOffice': case 'idSabreIssueOffice': case 'idTINABookUser': case 'idTINAIssueUser': case 'idTINABookOffice': case 'idTINAIssueOffice': { $this->fields[$var] = $value; break; } default: { return parent::setAttribute($var, $value); } } } } 