/**
  * Get ALL references from IRIS that have been paid for.
  *
  * @Route()
  * @Template()
  * @Method({"GET"})
  * @param Request $request
  * @return array
  */
 public function indexAction(Request $request)
 {
     // Firstly, get all references for this user, regardless of application status and payment status.
     $resultSet = $this->referenceRetriever->getReferencesByStatus(null, true);
     if (!$resultSet instanceof ReferencingApplicationSummaryCollection) {
         return array('landlord' => $this->irisEntityManager->find(new DirectLandlord()), 'results' => array(), 'viewMore' => false);
     }
     // Now filter out all references that haven't had a successful payment
     $filteredResults = $this->referenceRetriever->filterByPaymentStatus($resultSet, array(PaymentStatusCodes::SUCCESS));
     // Update the result with the filtered out results.
     $resultSet->setRecords((array) $filteredResults);
     // Only show the 5 most recent results on the dashboard.
     // Break results into 5 per page...
     if (0 < count($resultSet->getRecords())) {
         $resultPages = array_chunk($resultSet->getRecords(), 5);
         // ...then only return the 1st page
         $resultSet->setRecords(reset($resultPages));
         // Do we have more than 1 page?
         $viewMore = 1 < count($resultPages);
     } else {
         // We filtered down to an empty result set.
         $viewMore = false;
         $resultSet = array();
     }
     return array('landlord' => $this->irisEntityManager->find(new DirectLandlord()), 'results' => $resultSet, 'viewMore' => $viewMore);
 }
 /**
  * @Route()
  * @Method({"GET", "POST"})
  * @Template()
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction()
 {
     // get references from IRIS
     $results = $this->referenceRetriever->getReferencesByStatus(null, true);
     // Now filter out all references that haven't had a successful payment
     $filteredResults = $this->referenceRetriever->filterByPaymentStatus($results, array(PaymentStatusCodes::SUCCESS));
     // Update the result with the filtered out results.
     $results->setRecords($filteredResults);
     $results->setTotalRecords(count($filteredResults));
     return array('results' => $results);
 }