<?php
 namespace App\ImportedOrder; class Passenger_Type extends EntityAbstract { public $codeTina; public $codeSystem; protected function validateEntityFields(\App\MessagesCollector $messagesCollector): void { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); if ($this->codeTina and !in_array($this->codeTina, $CFG['generalData']['personTypes'])) { $messagesCollector->addInfo('The passenger type TINA code is not valid'); } } public function getMatchedId($idExternalSystem) { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $matchedCodes = []; if ($this->codeTina and in_array($this->codeTina, $CFG['generalData']['personTypes'])) { $matchedCodes[$this->codeTina] = true; } if ($this->codeSystem and $idExternalSystem) { $matchedType = \App\Config\ImportedOrders_Matches::getInstance()->getCustomerType($idExternalSystem, $this->codeSystem); if ($matchedType) { $matchedCodes[$matchedType] = true; } } if (count($matchedCodes)==1) { return key($matchedCodes); } else { return false; } } }