Gadoma / walmart-api-php-client

[2016] Walmart Open API PHP client
MIT License
8 stars 10 forks source link

Product Service Get By UPC doesn't work #7

Open jonrobinson opened 6 years ago

jonrobinson commented 6 years ago

ProductService::getByUpc() expects a single entity like the getById() call but it receives a collection.

This solves the issue:

/**
 * {@inheritdoc}
 */
public function getByUpc($upc)
{
        $this->guardString($upc);

        $collection = $this->getEntityCollection('items', ['upc' => $upc], self::COLLECTION_KEY);
        return $collection->getFirst();
}
gomcodoctor commented 6 years ago

better return collection instead of first