diff --git a/src/Action/Functions.php b/src/Action/Functions.php index cf401a88e69c6ee9b6873506c83e41e7fba0df6e..d40b98045f01db19b9b9271537b11abda02dcf1c 100644 --- a/src/Action/Functions.php +++ b/src/Action/Functions.php @@ -44,14 +44,4 @@ class Functions } return null; } - - /** - * Удалить дубликаты, оставив только уникальные значения - * @param array $array - * @return array - */ - public function uniqElements(array $array): array - { - return array_unique($array, SORT_REGULAR); - } } \ No newline at end of file diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index db9d53a5564324672f42776981da51b77b34d334..8d0a83a99f6641a98961a357e773ce986b5260b2 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -5,8 +5,7 @@ namespace App\Controller; use App\Action\Functions; use App\Requests\{ SortPriceRequest, - SearchRequest, - UniqElementsRequest + SearchRequest }; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; @@ -26,9 +25,9 @@ class HomeController extends AbstractController #[Route('/search', name: 'search', methods: ['POST'])] public function search(SearchRequest $request): Response { - $array = $request->getRequest()->toArray()['items']; - $id = $request->getRequest()->query->get('id'); - $result = $this->functions->search($array, $id); + $requestData = $request->getRequest()->toArray(); + $id = $request->getRequest()->get('id'); + $result = $this->functions->search($requestData['items'], $id); return $this->json($result); }