public static function validateMetadataProfileField($partnerId, $xsdData, $isPath, $obejctType, $metadataProfileId = null) { $additionalSearchableFieldsCounter = 0; $profileFields = MetadataProfileFieldPeer::retrieveIndexableByPartnerAndType($partnerId, $obejctType); foreach ($profileFields as $profileField) { if ($profileField->getMetadataProfileId() == $metadataProfileId) { continue; } $type = $profileField->getType(); if ($type == MetadataSearchFilter::KMC_FIELD_TYPE_DATE || $type == MetadataSearchFilter::KMC_FIELD_TYPE_INT) { $additionalSearchableFieldsCounter++; } } $xPaths = kXsd::findXpathsByAppInfo($xsdData, kMetadataManager::APP_INFO_SEARCH, 'true', $isPath); foreach ($xPaths as $xPath => $xPathData) { if (isset($xPathData['type']) && ($xPathData['type'] == MetadataSearchFilter::KMC_FIELD_TYPE_DATE || $xPathData['type'] == MetadataSearchFilter::KMC_FIELD_TYPE_INT)) { $additionalSearchableFieldsCounter++; } } $partnerLimit = MetadataPlugin::getAdditionalSearchableFieldsLimit($partnerId, $obejctType); if ($additionalSearchableFieldsCounter > $partnerLimit) { throw new APIException(MetadataErrors::EXCEEDED_ADDITIONAL_SEARCHABLE_FIELDS_LIMIT, $partnerLimit); } }