<?php
 namespace App\ImportedOrder; class MiceProject extends EntityAbstract { public $idTina; public $idSystem; public $name; public $code; protected function validateEntityFields(\App\MessagesCollector $messagesCollector): void { if ( $this->idTina and (!is_numeric($this->idTina) or $this->idTina<0) ) { $messagesCollector->addInfo('The TINA id is invalid - it should be a positive integer.'); } } public function getMatchedId($idExternalSystem) { $matchObj = new \App\ImportedOrder\EntityMatch\MiceProject('intersect'); if ($this->idTina) { $matchObj->setId($this->idTina); } if ($idExternalSystem and $this->idSystem) { $matchObj->setIdInExtSys($this->idSystem, $idExternalSystem); } if ($this->name) { $matchObj->setName($this->name); } if ($this->code) { $matchObj->setCode($this->code); } $matchObj->search(); if ($matchObj->getResultsCount()==1) { return $matchObj->getFirstMatchId(); } return 0; } } 