/**
  * Returns a paginated list of invoices.
  *
  * @ApiDoc(
  *  resource=true,
  *  output={"class"="Sonata\DatagridBundle\Pager\PagerInterface", "groups"="sonata_api_read"}
  * )
  *
  * @QueryParam(name="page", requirements="\d+", default="1", description="Page for invoices list pagination")
  * @QueryParam(name="count", requirements="\d+", default="10", description="Number of invoices by page")
  * @QueryParam(name="orderBy", array=true, requirements="ASC|DESC", nullable=true, strict=true, description="Query invoices invoice by clause (key is field, value is direction")
  * @QueryParam(name="status", requirements="\d+", nullable=true, strict=true, description="Filter on invoice statuses")
  *
  * @View(serializerGroups="sonata_api_read", serializerEnableMaxDepthChecks=true)
  *
  * @param ParamFetcherInterface $paramFetcher
  *
  * @return Sonata\DatagridBundle\Pager\PagerInterface
  */
 public function getInvoicesAction(ParamFetcherInterface $paramFetcher)
 {
     $supportedCriteria = array('status' => '');
     $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->invoiceManager->getPager($criteria, $page, $limit, $sort);
 }