Skip to content

Commit

Permalink
shoppingflux#18 - adding criterias structure to all necessary method
Browse files Browse the repository at this point in the history
  • Loading branch information
ddattee committed Jun 6, 2018
1 parent 6d8b7cd commit 90b57ff
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Resource/AbstractDomainResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,27 @@ public function __construct(Hal\HalLink $link)
}

/**
* @param int $page
* @param int $perPage
* @param array $criterias
*
* @return PaginatedResourceCollection
* @return null|PaginatedResourceCollection
*
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getPage($page = 1, $perPage = self::PER_PAGE)
public function getPage(array $criterias)
{
return $this->createPaginator($page, $perPage);
return $this->createPaginator($criterias);
}

/**
* @param int $fromPage
* @param int $perPage
* @param array $criterias
*
* @return AbstractResource[]|\Traversable
*
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getAll($fromPage = 1, $perPage = self::PER_PAGE)
public function getAll(array $criterias)
{
foreach ($this->getPages($fromPage, $perPage) as $collection) {
foreach ($this->getPages($criterias) as $collection) {
foreach ($collection as $item) {
yield $item;
}
Expand Down

0 comments on commit 90b57ff

Please sign in to comment.