<?php
namespace App\ImportedDocument; class Service extends EntityAbstract { public $idTina; protected function validateEntityFields(\App\MessagesCollector $messagesCollector) { 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() { if ($this->idTina) { $servEnt = \Entity\Service::select($this->idTina); if ($servEnt->recordExists()) { return $this->idTina; } return 0; } return 0; } }