vienthuong / shopware-php-sdk

A PHP SDK for Shopware 6 Admin API
MIT License
112 stars 44 forks source link

Error when trying to get Customers #10

Closed olivero86 closed 3 years ago

olivero86 commented 3 years ago

When I try to get Customers I get the following error: Vin\ShopwareSdk\Data\Struct::addExtension(): Argument #2 ($extension) must be of type Vin\ShopwareSdk\Data\Struct, null given, called When I use other entities such as ProductDefinition, the code works fine. Here is the code I used: `

    $customerRepository = RepositoryFactory::create(CustomerDefinition::ENTITY_NAME);        
    $grantType = new ClientCredentialsGrantType(Configure::read('Shopware.ACCESS_KEY_ID'), Configure::read('Shopware.ACCESS_KEY_SECRET'));
    $adminClient = new AdminAuthenticator($grantType, Configure::read('Shopware.BASE_URL'));
    $accessToken = $adminClient->fetchAccessToken();

    $context = new Context(Configure::read('Shopware.BASE_URL'), $accessToken);        

    $criteria = new Criteria();
    $customers = $customerRepository->search($criteria, $context)->getEntities();

`

vienthuong commented 3 years ago

Hi @olivero86 can you suggest me which SHopware version you're using?

And thanks for reporting it, I will check it right away :)

olivero86 commented 3 years ago

Hi @olivero86 can you suggest me which SHopware version you're using?

And thanks for reporting it, I will check it right away :)

Thanks, I'm using v6.4.4.1 Stable Version

vienthuong commented 3 years ago

Hi @olivero86 I published a new release for bug fixed, can you update the latest version and verify if it works now? https://github.com/vienthuong/shopware-php-sdk/releases/tag/1.3.1

olivero86 commented 3 years ago

Hi @olivero86 I published a new release for bug fixed, can you update the latest version and verify if it works now? https://github.com/vienthuong/shopware-php-sdk/releases/tag/1.3.1

It's working without errors, thank you.