Skip to content

Commit

Permalink
Fixing the errors?
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu committed Oct 17, 2023
1 parent 670065d commit 3e7c4aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Sylius/Bundle/ShopBundle/Grid/Account/OrderGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function buildGrid(GridBuilderInterface $gridBuilder): void
],
],
]),
Action::create('pay', 'pay')
Action::create('pay', 'shop_pay')
->setOptions([
'link' => [
'route' => 'sylius_shop_order_show',
Expand Down
17 changes: 12 additions & 5 deletions src/Sylius/Bundle/ShopBundle/Grid/ProductGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Webmozart\Assert\Assert;

final class ProductGrid extends AbstractGrid implements ResourceAwareGridInterface
Expand Down Expand Up @@ -56,15 +57,21 @@ public function buildGrid(GridBuilderInterface $gridBuilder): void
Assert::notNull($this->resquest);
$localeCode = $this->localeContext->getLocaleCode();

// @see Sylius\Bundle\ResourceBundle\ExpressionLanguage\NotNullExpressionFunctionProvider
$taxon = $this->taxonRepository->findOneBySlug(
$this->resquest->attributes->get('slug'),
$localeCode,
);
if ($taxon === null) {
throw new NotFoundHttpException('Requested page is invalid');
}

$gridBuilder
->setRepositoryMethod('createShopListQueryBuilder', [
$this->channelContext->getChannel(),
$this->taxonRepository->findOneBySlug(
$this->resquest->attributes->get('slug'),
$localeCode,
),
$taxon,
$localeCode,
$this->resquest->query->get('sorting') ?? [],
$this->resquest->query->all('sorting'),
$this->includeAllDescendants,
])
->orderBy('position', 'asc')
Expand Down

0 comments on commit 3e7c4aa

Please sign in to comment.