public function removeCompteWithOps(Compte $compte) { $operationRepository = $this->_em->getRepository("MITFinanceBundle:Operation"); $operationRepository->removeOperationByCompte($compte->getId()); $this->_em->remove($compte); $this->_em->flush(); }
/** * @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); }