try { $matchingPTs = searchTypeMetadata($queryTypes, $criteriaTree); } catch (Exception $e) { Utils::reportError("An exception occurred while searching type metadata: " . $e->getMessage(), $outputFormat); } foreach ($matchingPTs as $matchingType) { array_splice($queryTypes, array_search($matchingType, $queryTypes), 1); // Remove types that match from query foreach ($client->getProductsByProductType($matchingType) as $p) { // Add all products of matching types array_push($allMatchingProducts, array('product' => $p, 'typeName' => $matchingType->getName())); } } // Add criteria to query object $query = new CAS_Filemgr_Query(); $query->addCriterion($criteriaTree); // Perform the query and collect results try { foreach ($queryTypes as $type) { $queryResultsOfType = $client->query($query, $type); if (count($queryResultsOfType) > 0) { foreach ($queryResultsOfType as $matchingProduct) { array_push($allMatchingProducts, array('product' => $matchingProduct, 'typeName' => $type->getName())); } } } } catch (Exception $e) { Utils::reportError($e->getMessage(), $outputFormat); } // Narrow down the given products to the requested page (if page info is given) $requestedProducts = array();