From 4cefbce87eb5275b23e3f1d543295a0fc72155bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 29 Oct 2026 15:46:55 +0100 Subject: [PATCH] fix: /api/product no longer returns another product for some codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The product lookup also matched hotel aliases (matchcodes), joined on the product uid. Matchcodes only exist for hotels, so a hotel alias equal to the requested code matched whatever product had that hotel's uid. With no ordering, the database picked one of the rows: locally DPWGRU3 returned SnowZone and KHHMP returned Hotel Terrace instead of Roncalli Düren and Gasthof Heidelberg. The other 313 product codes return the same response as before. Products are looked up by code only. Some codes exist on two products (e.g. MVKPGW); ordering by uid makes the result deterministic. Co-Authored-By: Claude Opus 5.5 --- packages/ep_products/Classes/Middleware/ApiMiddleware.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ep_products/Classes/Middleware/ApiMiddleware.php b/packages/ep_products/Classes/Middleware/ApiMiddleware.php index 1344d8a..c19bcb3 100644 --- a/packages/ep_products/Classes/Middleware/ApiMiddleware.php +++ b/packages/ep_products/Classes/Middleware/ApiMiddleware.php @@ -163,9 +163,9 @@ class ApiMiddleware implements MiddlewareInterface ->from('tx_epproducts_domain_model_product', 'product') ->leftJoin('product', 'tx_epproducts_domain_model_country', 'country', 'product.country = country.uid') ->leftJoin('product', 'tx_epproducts_domain_model_city', 'city', 'product.city = city.uid') - ->leftJoin('product', 'tx_epproducts_domain_model_matchcode', 'matchcode', 'product.uid = matchcode.entity AND matchcode.entity_type="hotel"') ->where($queryBuilder->expr()->eq('product.code', $queryBuilder->createNamedParameter($productCode))) - ->orWhere($queryBuilder->expr()->eq('matchcode.code', $queryBuilder->createNamedParameter($productCode)))->setMaxResults(1)->executeQuery() + ->orderBy('product.uid') + ->setMaxResults(1)->executeQuery() ->fetchAssociative() ;