/**
  * @test
  */
 public function testGetCriteria()
 {
     $processor = new CommentFilterCriteriaProcessor();
     $processor->setCommand($this->commentFilterCommand);
     $expectedCriteria = array(array('author', 'eq', 'diamante_1'), array('content', 'like', 'Test'), array('ticket', 'eq', 1));
     $criteria = $processor->getCriteria();
     $this->assertNotEmpty($criteria);
     $this->assertCount(3, $criteria);
     for ($i = 0; $i < count($expectedCriteria); $i++) {
         $this->assertEquals($expectedCriteria[$i], $criteria[$i]);
     }
 }
 /**
  * Retrieves list of all Comments.
  * Filters comments with parameters provided via 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 tickets.",
  *  uri="/comments.{_format}",
  *  method="GET",
  *  resource=true,
  *  statusCodes={
  *      200="Returned when successful",
  *      403="Returned when the user is not authorized to list tickets"
  *  }
  * )
  *
  * @param Command\Filter\FilterCommentsCommand $command
  * @return Comment[]
  */
 public function listAllComments(Command\Filter\FilterCommentsCommand $command)
 {
     $criteriaProcessor = new CommentFilterCriteriaProcessor();
     $criteriaProcessor->setCommand($command);
     $criteria = $criteriaProcessor->getCriteria();
     $pagingProperties = $criteriaProcessor->getPagingProperties();
     $repository = $this->getCommentsRepository();
     $comments = $repository->filter($criteria, $pagingProperties);
     try {
         $pagingInfo = $this->apiPagingService->getPagingInfo($repository, $pagingProperties, $criteria);
         $this->populatePagingHeaders($this->apiPagingService, $pagingInfo);
     } catch (\Exception $e) {
     }
     return $comments;
 }