Skip to content

Commit

Permalink
Merge pull request #3 from prhost/master
Browse files Browse the repository at this point in the history
 fix order foreach quando vindo null e retornando o create da categoria
  • Loading branch information
prhost authored Jul 29, 2019
2 parents e47b712 + f633a47 commit 41bb713
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Endpoints/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getCategories(int $level = 0, int $page = 1, int $perPage = 100)

public function createCategories(Categories $categories)
{
$this->request('POST', 'Category', [
return $this->request('POST', 'Category', [
'json' => $categories->getCategories()->toArray()
]);
}
Expand Down
6 changes: 4 additions & 2 deletions src/Model/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public function __construct(\StdClass $data = null)
$this->perPage = $data->PerPage;
$this->total = $data->Total;

foreach ($data->Orders as $order) {
$this->orders->push(new Order($order));
if ($data->Orders) {
foreach ($data->Orders as $order) {
$this->orders->push(new Order($order));
}
}
}
}
Expand Down

0 comments on commit 41bb713

Please sign in to comment.