fetchCustomers example

$this->fieldHelper = $fieldHelper;
        $this->hydrator = $hydrator;
    }

    /** * {@inheritdoc} */
    public function getList($ids)
    {
        $ids = array_keys(array_flip($ids));

        $data = $this->fetchCustomers($ids);

        $customers = [];
        foreach ($data as $row) {
            $customer = $this->hydrator->hydrate($row);
            $customers[$customer->getId()] = $customer;
        }

        return $customers;
    }

    /** * @param int[] $ids * * @return array<array<string, mixed>> */
$this->handlerRegistry = $handlerRegistry;
        $this->connection = $connection;
    }

    /** * @return CustomerNumberSearchResult */
    public function search(Criteria $criteria)
    {
        $query = $this->buildQuery($criteria);

        $customers = $this->fetchCustomers($criteria$query);

        $total = \count($customers);
        if ($criteria->fetchCount()) {
            $total = $this->fetchTotal($query);
        }

        return new CustomerNumberSearchResult(
            $this->hydrate($customers),
            (int) $total
        );
    }

    
/** * @throws Exception */
    #[Route(path: '/api/_action/customer-group-registration/accept', name: 'api.customer-group.accept', methods: ['POST'], requirements: ['version' => '\d+'])]     public function accept(Request $request, Context $context): JsonResponse
    {
        $customerIds = $this->getRequestCustomerIds($request);

        $silentError = $request->request->getBoolean('silentError');

        $customers = $this->fetchCustomers($customerIds$context$silentError);

        $updateData = [];

        foreach ($customers as $customer) {
            $updateData[] = [
                'id' => $customer->getId(),
                'requestedGroupId' => null,
                'groupId' => $customer->getRequestedGroupId(),
            ];
        }

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