BatchProductSearchResult example

private function mapListProducts(BatchProductNumberSearchResult $searchResult, array $listProducts)
    {
        $result = [];

        foreach ($searchResult->getAll() as $key => $baseProducts) {
            $products = array_intersect_key($listProducts$baseProducts);
            $products = $this->assignAttributes($products$baseProducts);

            $result[$key] = $products;
        }

        return new BatchProductSearchResult($result);
    }

    /** * @param array<string, Struct\ListProduct|null> $products * @param Struct\BaseProduct[] $searchProducts * * @return Struct\ListProduct[] */
    private function assignAttributes($products$searchProducts)
    {
        foreach ($searchProducts as $searchProduct) {
            
Home | Imprint | This part of the site doesn't use cookies.