Example #1
0
 public function removeCompteWithOps(Compte $compte)
 {
     $operationRepository = $this->_em->getRepository("MITFinanceBundle:Operation");
     $operationRepository->removeOperationByCompte($compte->getId());
     $this->_em->remove($compte);
     $this->_em->flush();
 }
Example #2
0
 /**
  * @param Compte $compte
  * @return ArrayCollection
  */
 public function findOperationsByCompte(Compte $compte)
 {
     $qb = $this->_em->createQueryBuilder();
     $qb->select('op')->from('MITFinanceBundle:Operation', 'op')->join('op.compte', 'c')->where('c.id=' . $compte->getId());
     $query = $qb->getQuery()->getResult();
     return new ArrayCollection($query);
 }
Example #3
0
 public function findByCompteAction($id)
 {
     $compte = new Compte();
     $compte->setId($id);
     $operations = $this->getDoctrine()->getRepository("MITFinanceBundle:Operation")->findOperationsByCompte($compte);
     return $this->render("MITFinanceBundle:Operation:getOperationsByCompte.html.twig", array('operations' => $operations));
 }
Example #4
0
 public function createAction(Request $request)
 {
     $compte = new Compte();
     if ($request->getMethod() == 'POST') {
         $rib = $request->get('rib');
         if (isset($rib)) {
             $compte->setRib($rib)->setSolde($request->get('solde'));
             $this->getDoctrine()->getRepository("MITFinanceBundle:Compte")->save($compte);
             return $this->redirect($this->generateUrl('listComptes'));
         }
     }
     return $this->render('MITFinanceBundle:Compte:saveCompte.html.twig');
 }