getAdditionalTexts example



    /** * @param array{data: array<array<string, mixed>>, total: int} $result * * @return array{data: array<array<string, mixed>>, total: int} */
    private function addAdditionalText(array $result): array
    {
        $products = $this->buildListProducts($result['data']);

        $products = $this->getAdditionalTexts($products);

        foreach ($result['data'] as &$item) {
            $number = $item['Detail_number'];
            $item['Detail_additionalText_dynamic'] = null;
            if (!isset($products[$number])) {
                continue;
            }
            $item['Detail_additionalText_dynamic'] = $products[$number]->getAdditional();
        }

        return $result;
    }
$query = $builder->getQuery();
            $query->setHydrationMode(AbstractQuery::HYDRATE_ARRAY);
            $paginator = $this->getModelManager()->createPaginator($query);

            // returns the total count of the query             $totalResult = $paginator->count();

            // returns the customer data             $result = iterator_to_array($paginator);

            $products = $this->buildListProducts($result);
            $products = $this->getAdditionalTexts($products);
            $result = $this->assignAdditionalText($result$products);

            $this->View()->assign([
                'data' => $result,
                'total' => $totalResult,
                'success' => true,
            ]);

            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.