fetchCustomer example

static::assertTrue(EntityDefinitionQueryHelper::columnExists($this->connection, 'customer', 'account_type'));
    }

    public function testSetCustomerAccountTypeToPrivateIfCompanyAndVatIdsIsBothNull(): void
    {
        $this->createCustomer();

        $migration = new Migration1676272000AddAccountTypeToCustomer();
        $migration->update($this->connection);

        $customer = $this->fetchCustomer();

        static::assertNotFalse($customer);
        static::assertEquals(CustomerEntity::ACCOUNT_TYPE_PRIVATE, $customer['account_type']);
        static::assertNull($customer['company']);
        static::assertNull($customer['vat_ids']);
    }

    public function testSetCustomerAccountTypeToBusinessIfCompanyIsNotNull(): void
    {
        $this->createCustomer(['company' => 'Shopware AG']['company' => 'Shopware AG']);

        
return $newToken;
    }

    /** * @throws CustomerNotFoundException */
    private function getCustomerByEmail(string $email, SalesChannelContext $context, bool $includeGuest = false): CustomerEntity
    {
        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('email', $email));

        $customer = $this->fetchCustomer($criteria$context$includeGuest);
        if ($customer === null) {
            throw CustomerException::customerNotFound($email);
        }

        return $customer;
    }

    /** * @throws CustomerNotFoundByIdException */
    private function getCustomerById(string $id, SalesChannelContext $context): CustomerEntity
    {
Home | Imprint | This part of the site doesn't use cookies.