コード例 #1
0
 /**
  * @Route("/transaction", name="transaction")
  */
 public function indexAction()
 {
     $oRepo = $this->getRepoEntity('Account');
     $aAccount = $oRepo->getAccountsListForm($this->container);
     $nAccount = count($aAccount);
     $aLastSearch = $this->findInSession('lastSearch');
     // si aucun compte dans la base de donnnée
     if (0 == $nAccount) {
         return $this->redirect($this->generateUrl('account'));
     }
     $sDateBegin = Help::getCustomDate('Y-m-d', 'first day of last month');
     $sDateEnd = Help::getCustomDate('Y-m-d', 'last day of last month');
     if (!empty($aLastSearch)) {
         $sDateBegin = $aLastSearch['date_begin'];
         $sDateEnd = $aLastSearch['date_end'];
     }
     $aCategories = $this->getRepoEntity('Category')->getCategories($this->container);
     $oForm = $this->createForm(new BasicForm($aAccount, $sDateBegin, $sDateEnd, $aCategories, true));
     return $this->render('AnalyzerBundle:Transaction:index.html.twig', array('form' => $oForm->createView(), 'formAction' => $this->generateUrl('findTransactions')));
 }
コード例 #2
0
 /**
  * Index
  * @Route("/home", name="home")
  */
 public function indexAction(Request $oRequest)
 {
     $oRepo = $this->getRepoEntity('Account');
     $aAccount = $oRepo->getAccountsListForm($this->container);
     $nAccount = count($aAccount);
     $aLastSearch = $this->findInSession('lastSearch');
     // si aucun compte dans la base de donnnée
     if (0 == $nAccount) {
         return $this->redirect($this->generateUrl('account'));
     }
     $sDateBegin = Help::getCustomDate('Y-m-d', 'first day of last month');
     $sDateEnd = Help::getCustomDate('Y-m-d', 'last day of last month');
     if (!empty($aLastSearch)) {
         $sDateBegin = $aLastSearch['date_begin'];
         $sDateEnd = $aLastSearch['date_end'];
     }
     $oForm = $this->createForm(new BasicForm($aAccount, $sDateBegin, $sDateEnd));
     $oRep = $this->getRepoEntity('Transaction');
     $oObj = $oRep->getLastTransaction();
     $oLastDate = !is_null($oObj) ? $oObj->getCreatedAt() : null;
     return $this->render('AnalyzerBundle:Index:index.html.twig', array('oLastDate' => $oLastDate, 'form' => $oForm->createView(), 'formAction' => $this->generateUrl('basicStatistics'), 'nAccount' => $nAccount));
 }