Skip to content

Commit

Permalink
Merge pull request #437 from wizaplace/hotfix/wiz-517-array-filter-di…
Browse files Browse the repository at this point in the history
…visions

wiz-517 fix array filter with null data
  • Loading branch information
wizacedric authored Jan 14, 2019
2 parents b491efc + de7aebc commit 87e2ae3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.44.11

### Bugfixes

- Fixed `\Wizaplace\SDK\Catalog\ProductOffer` with null `$data['divisions']`
- Fixed `\Wizaplace\SDK\Catalog\ProductSummary::getOffers` return null

## 1.44.10

### New features
Expand Down
4 changes: 2 additions & 2 deletions src/Catalog/ProductOffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function __construct(array $data)
{
$this->productId = (int) $data['productId'];
$this->companyId = (int) $data['companyId'];
$this->price = (float) $data['price'];
$this->divisions = array_filter($data['divisions']);
$this->price = (float) $data['price'];
$this->divisions = is_array($data['divisions']) ? array_filter($data['divisions']) : [];
}

public function getProductId(): int
Expand Down
5 changes: 4 additions & 1 deletion src/Catalog/ProductSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ public function getMainDeclinationId(): ?DeclinationId
return $this->mainDeclinationId;
}

public function getOffers(): array
/**
* @return null|ProductOffer[]
*/
public function getOffers(): ?array
{
return $this->offers;
}
Expand Down

0 comments on commit 87e2ae3

Please sign in to comment.