public function earnMoreAction(Request $request)
 {
     $localAuthor = $this->get('security.context')->getToken()->getUser();
     $streetCredit = $this->getDoctrine()->getRepository("BugglMainBundle:StreetCredit")->findOneByLocalAuthor($localAuthor);
     $newEGuideRequestCount = $this->getDoctrine()->getEntityManager()->getRepository('BugglMainBundle:MessageToUser')->countRequestByStatus($localAuthor, array('0' => '0'));
     if (is_null($streetCredit)) {
         $streetCredit = new StreetCredit();
         $streetCredit->setLocalAuthor($localAuthor);
         $entityManager = $this->getDoctrine()->getEntityManager();
         $entityManager->persist($streetCredit);
         $entityManager->flush();
     }
     $paymentsService = $this->get('buggl_main.buggl_payment_service');
     $credit = $paymentsService->getCreditValue($localAuthor);
     $bugglShare = $this->get('buggl_main.constants')->get('buggl_payment_share') * 100;
     $commission = 100 - ($bugglShare - $credit);
     $data = array('streetCredit' => $streetCredit, 'newRequestCount' => $newEGuideRequestCount, 'commission' => $commission);
     return $this->render('BugglMainBundle:LocalAuthor\\EarnMore:earnMore.html.twig', $data);
 }
 private function getStreetCredit($localAuthor)
 {
     $streetCredit = $this->entityManager->getRepository("BugglMainBundle:StreetCredit")->findOneByLocalAuthor($localAuthor);
     if (is_null($streetCredit)) {
         $streetCredit = new StreetCredit();
         $streetCredit->setLocalAuthor($localAuthor);
     }
     return $streetCredit;
 }