<?php
 namespace Modules\RemoteData\EntityManagementWs\Model\Entity\SupplierProduct; class Matching extends \Modules\RemoteData\EntityManagementWs\Model\Entity\MatchingAbstract { protected $forcedRequestAttributes = ['externalSystem', 'productName', 'serviceCode', 'destinationCountryCode', 'destinationCityId']; protected function checkRequestData() :void { if (!$this->request->externalSystem and !$this->request->productName) { throw new \Modules\RemoteData\EntityManagementWs\Model\RuntimeException('At least one criteria for matching must be set.', 'SupplierProductMatchCriteriaMissing'); } if ($this->request->productName and mb_strlen($this->request->productName) < 3) { throw new \Modules\RemoteData\EntityManagementWs\Model\RuntimeException('The product name value must have at least 3 characters.', 'SupplierProductMatchProductNameMinLength'); } } protected function getEntityMatchObj() :\App\EntityMatch\BaseAbstract { $supplierProductMatchObj = new \App\ImportedOrder\EntityMatch\SupplierProduct('intersect'); if ($this->request->externalSystem) { $supplierProductMatchObj->setIdInExtSys($this->request->externalSystem->idEntityExtSys, $this->request->externalSystem->idSystem); } if ($this->request->productName) { $supplierProductMatchObj->setProductName($this->request->productName); } if ($this->request->serviceCode) { $supplierProductMatchObj->filterByServiceCode($this->request->serviceCode); } if ($this->request->destinationCountryCode) { $supplierProductMatchObj->filterByCountryCode($this->request->destinationCountryCode); } if ($this->request->destinationCityId) { $supplierProductMatchObj->filterByCityId($this->request->destinationCityId); } return $supplierProductMatchObj; } } 