<?php
 namespace App\ImportedOrder; class Passenger_Passport extends EntityAbstract { public $number; public $type; public $firstName; public $lastName; public $issueDate; public $issuedBy; public ?\App\ImportedOrder\Country $issueCountry = null; public ?\App\ImportedOrder\Country $citizenship = null; public $expireDate; protected function validateEntityFields(\App\MessagesCollector $messagesCollector): void { if ($this->issueDate and !validDate($this->issueDate)) { $messagesCollector->addInfo('The issue date is not valid.'); } if ($this->expireDate and !validDate($this->expireDate)) { $messagesCollector->addInfo('The expire date is not valid.'); } if ($this->issueCountry) { $messagesCollector->appendMessages( $this->issueCountry->getValidatingMessagesCollector(), "Issue country: %s" ); } if ($this->citizenship) { $messagesCollector->appendMessages( $this->citizenship->getValidatingMessagesCollector(), "Citizenship coutry: %s" ); } } } 