/**
  * Returns a paginated list of products.
  *
  * @ApiDoc(
  *  resource=true,
  *  output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"="sonata_api_read"}
  * )
  *
  * @QueryParam(name="page", requirements="\d+", default="1", description="Page for products list pagination (1-indexed)")
  * @QueryParam(name="count", requirements="\d+", default="10", description="Number of products by page")
  * @QueryParam(name="orderBy", array=true, requirements="ASC|DESC", nullable=true, strict=true, description="Query products order by clause (key is field, value is direction")
  * @QueryParam(name="enabled", requirements="0|1", nullable=true, strict=true, description="Enabled/disabled products only?")
  *
  * @View(serializerGroups="sonata_api_read", serializerEnableMaxDepthChecks=true)
  *
  * @param ParamFetcherInterface $paramFetcher
  *
  * @return Sonata\DatagridBundle\Pager\PagerInterface
  */
 public function getProductsAction(ParamFetcherInterface $paramFetcher)
 {
     $supportedCriteria = array('enabled' => '');
     $page = $paramFetcher->get('page');
     $limit = $paramFetcher->get('count');
     $sort = $paramFetcher->get('orderBy');
     $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria);
     foreach ($criteria as $key => $value) {
         if (null === $value) {
             unset($criteria[$key]);
         }
     }
     if (!$sort) {
         $sort = array();
     } elseif (!is_array($sort)) {
         $sort = array($sort => 'asc');
     }
     return $this->productManager->getPager($criteria, $page, $limit, $sort);
 }