<?php
namespace Bidcoz\Bundle\FrontendBundle\Controller\Auction;
use Bidcoz\Bundle\CoreBundle\Controller\CoreController;
use Bidcoz\Bundle\CoreBundle\Entity\Auction\Shop;
use Bidcoz\Bundle\CoreBundle\Entity\Campaign;
use Bidcoz\Bundle\CoreBundle\Entity\Organization;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/{orgSlug}/{campaignSlug}/shop")
* @IsGranted("VIEW", subject="organization")
* @IsGranted("FRONT_END", subject="campaign")
*/
class ShopController extends CoreController
{
use ItemCatalogQueryTrait;
/**
* @Route("/list", name="shop_catalog")
*/
public function catalogAction(Request $request, Organization $organization, Campaign $campaign, Shop $shop)
{
$qb = $this->getRepository('Auction\Item')->getAuctionQueryBuilder($shop, true, false);
$filterForm = $this->getItemFilterForm($shop);
$hasFilter = $this->applyFilters($request, $filterForm, $qb);
$orderForm = $this->getItemOrderForm();
// No fixed-price exclusion on bid-count sorts here: a shop is almost
// entirely fixed-price, so applying the auction catalog's rule would
// empty it. This matches what this controller has always done.
$hasOrder = $this->applyOrder($request, $orderForm, $qb);
$items = $this->getPagination($qb);
return $this->render('@BidcozFrontend/Auction/catalog.html.twig', [
'type' => 'shop',
'title' => $campaign->getShopDisplayName().' Catalog',
'organization' => $organization,
'campaign' => $campaign,
'auction' => $shop,
'filterForm' => $filterForm->createView(),
'orderForm' => $orderForm->createView(),
'items' => $items,
'hasFilter' => $hasFilter || $hasOrder,
'requireCC' => !$this->isGranted('WITH_CC', $campaign),
// Carried onto every item link so the item page's "More Items"
// carousel can mirror this catalog's sort and filters (CAU-356).
'carryParams' => $this->getCatalogCarryParams($request, $filterForm, $orderForm),
]);
}
}