src/Bidcoz/Bundle/FrontendBundle/Controller/Auction/FundANeedController.php line 25

Open in your IDE?
  1. <?php
  2. namespace Bidcoz\Bundle\FrontendBundle\Controller\Auction;
  3. use Bidcoz\Bundle\CoreBundle\Controller\CoreController;
  4. use Bidcoz\Bundle\CoreBundle\Entity\Auction\FundANeed;
  5. use Bidcoz\Bundle\CoreBundle\Entity\Campaign;
  6. use Bidcoz\Bundle\CoreBundle\Entity\Organization;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. /**
  11.  * @Route("/{orgSlug}/{campaignSlug}/fund-a-need")
  12.  * @IsGranted("VIEW", subject="organization")
  13.  * @IsGranted("FRONT_END", subject="campaign")
  14.  */
  15. class FundANeedController extends CoreController
  16. {
  17.     use ItemCatalogQueryTrait;
  18.     /**
  19.      * @Route("/list", name="fund_a_need_catalog")
  20.      */
  21.     public function catalogAction(Request $requestOrganization $organizationCampaign $campaignFundANeed $fundANeed)
  22.     {
  23.         // CAU-279: group by item so multi-row joins (purchase/images/packagedItems)
  24.         // don't duplicate rows and shorten the paginated page. See AuctionController.
  25.         $qb $this->getRepository('Auction\Item')->getAuctionQueryBuilder($fundANeedtruetrue);
  26.         $filterForm $this->getItemFilterForm($fundANeed);
  27.         $hasFilter  $this->applyFilters($request$filterForm$qb);
  28.         $orderForm $this->getItemOrderForm();
  29.         // No fixed-price exclusion on bid-count sorts — see ShopController.
  30.         $hasOrder $this->applyOrder($request$orderForm$qb);
  31.         $items $this->getPagination($qb);
  32.         return $this->render('@BidcozFrontend/Auction/catalog.html.twig', [
  33.             'type'         => 'fund-a-need',
  34.             'title'        => $campaign->getFundANeedDisplayName().' Catalog',
  35.             'organization' => $organization,
  36.             'campaign'     => $campaign,
  37.             'auction'      => $fundANeed,
  38.             'filterForm'   => $filterForm->createView(),
  39.             'orderForm'    => $orderForm->createView(),
  40.             'items'        => $items,
  41.             'hasFilter'    => $hasFilter || $hasOrder,
  42.             'requireCC'    => !$this->isGranted('WITH_CC'$campaign),
  43.             // Carried onto every item link so the item page's "More Items"
  44.             // carousel can mirror this catalog's sort and filters (CAU-356).
  45.             'carryParams'  => $this->getCatalogCarryParams($request$filterForm$orderForm),
  46.         ]);
  47.     }
  48. }