/**
  * Retrieves list of all Branches. Filters branches with parameters provided within GET request
  * Time filtering parameters as well as paging/sorting configuration parameters can be found in \Diamante\DeskBundle\Api\Command\CommonFilterCommand class.
  * Time filtering values should be converted to UTC
  *
  * @ApiDoc(
  *  description="Returns all branches",
  *  uri="/branches.{_format}",
  *  method="GET",
  *  resource=true,
  *  statusCodes={
  *      200="Returned when successful",
  *      403="Returned when the user is not authorized to list branches"
  *  }
  * )
  * @param Command\Filter\FilterBranchesCommand $command|null
  * @return \Diamante\DeskBundle\Model\Branch\Branch[]
  */
 public function listAllBranches(Command\Filter\FilterBranchesCommand $command = null)
 {
     $processor = new BranchFilterCriteriaProcessor();
     $processor->setCommand($command);
     $criteria = $processor->getCriteria();
     $pagingProperties = $processor->getPagingProperties();
     $repository = $this->getBranchRepository();
     $branches = $repository->filter($criteria, $pagingProperties);
     try {
         $pagingInfo = $this->apiPagingService->getPagingInfo($repository, $pagingProperties, $criteria);
         $this->populatePagingHeaders($this->apiPagingService, $pagingInfo);
     } catch (\Exception $e) {
     }
     return $branches;
 }
 /**
  * @test
  */
 public function testGetPagingPropertiesWithModifiedValues()
 {
     $command = new FilterBranchesCommand();
     $command->limit = 50;
     $command->page = 2;
     $command->sort = 'subject';
     $command->order = 'DESC';
     $processor = new BranchFilterCriteriaProcessor();
     $processor->setCommand($command);
     $pagingProperties = $processor->getPagingProperties();
     $this->assertInstanceOf('\\Diamante\\DeskBundle\\Model\\Shared\\Filter\\PagingProperties', $pagingProperties);
     $this->assertEquals(50, $pagingProperties->getLimit());
     $this->assertEquals(2, $pagingProperties->getPage());
     $this->assertEquals('subject', $pagingProperties->getSort());
     $this->assertEquals('DESC', $pagingProperties->getOrder());
 }