-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed dependency on App from frontend-api package
- Loading branch information
1 parent
2481674
commit 6d85dc0
Showing
2 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/src/FrontendApi/Resolver/Products/BestsellingProductsQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\FrontendApi\Resolver\Products; | ||
|
||
use App\Model\CategorySeo\ReadyCategorySeoMix; | ||
use GraphQL\Executor\Promise\Promise; | ||
use Shopsys\FrameworkBundle\Model\Category\Category; | ||
use Shopsys\FrontendApiBundle\Model\Resolver\Products\BestsellingProductsQuery as BaseBestsellingProductsQuery; | ||
|
||
class BestsellingProductsQuery extends BaseBestsellingProductsQuery | ||
{ | ||
/** | ||
* @param \App\Model\Category\Category|\App\Model\CategorySeo\ReadyCategorySeoMix $categoryOrReadyCategorySeoMix | ||
* @return \GraphQL\Executor\Promise\Promise | ||
*/ | ||
public function bestSellingProductsByCategoryOrReadyCategorySeoMixQuery( | ||
Category|ReadyCategorySeoMix $categoryOrReadyCategorySeoMix, | ||
): Promise { | ||
$category = $categoryOrReadyCategorySeoMix instanceof ReadyCategorySeoMix | ||
? $categoryOrReadyCategorySeoMix->getCategory() | ||
: $categoryOrReadyCategorySeoMix; | ||
|
||
$bestsellingProductsIds = $this->cachedBestsellingProductFacade->getOfferedBestsellingProductIds( | ||
$this->domain->getId(), | ||
$category, | ||
$this->currentCustomerUser->getPricingGroup(), | ||
$this->productFrontendLimitProvider->getProductsFrontendLimit(), | ||
); | ||
|
||
return $this->productsSellableByIdsBatchLoader->load($bestsellingProductsIds); | ||
} | ||
} |