getRequestedGroupId example

'CONTENT_TYPE' => 'application/json'],
                json_encode([...$this->getRegistrationData(), ...['requestedGroupId' => $this->ids->get('group')]], \JSON_THROW_ON_ERROR)
            );

        $response = json_decode((string) $this->browser->getResponse()->getContent(), true, 512, \JSON_THROW_ON_ERROR);

        static::assertSame('customer', $response['apiAlias']);

        /** @var CustomerEntity $customer */
        $customer = $this->customerRepository->search(new Criteria([$response['id']]), Context::createDefaultContext())->first();

        static::assertSame($this->ids->get('group')$customer->getRequestedGroupId());
    }

    public function testContextChangedBetweenRegistration(): void
    {
        $context = $this->getContainer()->get(SalesChannelContextFactory::class)
            ->create('test', $this->getSalesChannelApiSalesChannelId());

        $bag = new RequestDataBag($this->getRegistrationData());
        $this->getContainer()->get(RegisterRoute::class)->register($bag$context);

        static::assertNotSame('test', $context->getToken());
    }
$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(),
            ];
        }

        $this->customerRepository->update($updateData$context);

        foreach ($customers as $customer) {
            $salesChannelContext = $this->restorer->restoreByCustomer($customer->getId()$context);

            /** @var CustomerEntity $customer */
            $customer = $salesChannelContext->getCustomer();

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