From ed1076fa5afe17bdab8c32b0922a80f7455a9d23 Mon Sep 17 00:00:00 2001 From: jona Date: Sat, 21 Dec 2024 12:23:51 +0100 Subject: [PATCH] replaced unnecessary double quotes --- src/Controller/InfoProviderController.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Controller/InfoProviderController.php b/src/Controller/InfoProviderController.php index 4c27dffe..4f9e2961 100644 --- a/src/Controller/InfoProviderController.php +++ b/src/Controller/InfoProviderController.php @@ -75,31 +75,31 @@ class InfoProviderController extends AbstractController private function matchResultsToKnownParts(array $partsList): array { //we need a manufacturer object to look for a manufacturer - $manufacturerQb = $this->em->getRepository(Manufacturer::class)->createQueryBuilder("manufacturer"); - $manufacturerQb->where($manufacturerQb->expr()->like("LOWER(manufacturer.name)", "LOWER(:manufacturer_name)")); + $manufacturerQb = $this->em->getRepository(Manufacturer::class)->createQueryBuilder('manufacturer'); + $manufacturerQb->where($manufacturerQb->expr()->like('LOWER(manufacturer.name)', 'LOWER(:manufacturer_name)')); //check if both manufacturer and Manufacturer part namber matches. If so, it must be the same part //use LOWER to make the search independent of case - $mpnQb = $this->em->getRepository(Part::class)->createQueryBuilder("part"); - $mpnQb->where($mpnQb->expr()->like("LOWER(part.manufacturer_product_number)", "LOWER(:mpn)")); - $mpnQb->andWhere($mpnQb->expr()->eq("part.manufacturer", ":manufacturer")); + $mpnQb = $this->em->getRepository(Part::class)->createQueryBuilder('part'); + $mpnQb->where($mpnQb->expr()->like('LOWER(part.manufacturer_product_number)', 'LOWER(:mpn)')); + $mpnQb->andWhere($mpnQb->expr()->eq('part.manufacturer', ':manufacturer')); foreach ($partsList as $index => $part) { - $manufacturerQb->setParameter("manufacturer_name", $part["dto"]->manufacturer); + $manufacturerQb->setParameter('manufacturer_name', $part['dto']->manufacturer); $manufacturers = $manufacturerQb->getQuery()->getResult(); if(!$manufacturers) { continue; } - $mpnQb->setParameter("manufacturer", $manufacturers); - $mpnQb->setParameter("mpn", $part["dto"]->mpn); + $mpnQb->setParameter('manufacturer', $manufacturers); + $mpnQb->setParameter('mpn', $part['dto']->mpn); $localParts = $mpnQb->getQuery()->getResult(); if(!$localParts) { continue; } //We only use the first matching part. If a user already has duplicate parts they will get a random one - $partsList[$index]["localPart"] = $localParts[0]; + $partsList[$index]['localPart'] = $localParts[0]; } return $partsList; } @@ -136,7 +136,7 @@ class InfoProviderController extends AbstractController // modify the array to an array of arrays that has a field for a matching local Part // the advantage to use that format even when we don't look for local parts is that we // always work with the same interface - $results = array_map(function ($result) {return ["dto" => $result,"localPart" => null];}, $results); + $results = array_map(function ($result) {return ['dto' => $result, 'localPart' => null];}, $results); if(!$update_target) { $results = $this->matchResultsToKnownParts($results); }