<?php
 namespace Modules\RemoteData\EntityManagementWs\Model\Entity\Customer; class Select extends \Modules\RemoteData\EntityManagementWs\Model\Entity\SelectAbstract { protected $entityClass = 'Customer'; protected $responseFields = [ 'lastNameStandard', 'lastNameLocal', 'firstNameStandard', 'firstNameLocal', 'middleNameStandard', 'middleNameLocal', 'locked', 'lockedComments', 'idCorporate', 'idSegment', 'title', 'type', 'idParent', 'department', 'birthday', 'PNC', 'ID_series', 'ID_number', 'ID_releaseBy', 'ID_releaseDate', 'ID_expireDate', 'address', 'deliveryAddress', 'zipCode', 'countryCode', 'cityId', 'idBank', 'idBankOffice', 'bankAccount', 'email', 'telephone', 'telephoneMobile', 'fax', 'comments', 'remarks', 'idAccountManager', 'flag', 'accountingNumber', ]; protected function getResponseFieldsFromEntity(\App\Entity\SelectAbstract $entityObj) : \stdClass { $outputFields = parent::getResponseFieldsFromEntity($entityObj); $customerEnt = \Entity\Customer::select($this->id); $cards = []; foreach ($customerEnt->frequentBuyerCards as $card) { $buyerCard = new \stdClass(); $buyerCard->cardNumber = $card['cardNumber']; if ($card['idSuppliers']) { $buyerCard->idSuppliers = $card['idSuppliers']; } $cards[] = $buyerCard; } if ($cards) { $outputFields->frequentBuyerCards = $cards; } $defaultPassport = $customerEnt->defaultPassport; if ($defaultPassport) { $passport = new \stdClass(); $passport->id = $defaultPassport['id']; $passport->number = $defaultPassport['number'] ? $defaultPassport['number'] : null; $passport->type = $defaultPassport['type'] ? $defaultPassport['type'] : null; $passport->firstName = $defaultPassport['firstName']; $passport->lastName = $defaultPassport['lastName']; $passport->expireDate = $defaultPassport['expireDate'] ? $defaultPassport['expireDate'] : null; $passport->issueDate = $defaultPassport['issueDate'] ? $defaultPassport['issueDate'] : null; $passport->issuedBy = $defaultPassport['issuedBy'] ? $defaultPassport['issuedBy'] : null; $passport->issueCountryCode = $defaultPassport['issueCountryCode'] ? $defaultPassport['issueCountryCode'] : null; $passport->citizenship = $defaultPassport['citizenship'] ? $defaultPassport['citizenship'] : null; $outputFields->defaultPassport = $passport; } return $outputFields; } } 