/**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $this->manager = $manager;
     $members = $manager->getRepository('ESNMembersBundle:Member')->findAll();
     $trips = $manager->getRepository('ESNAdministrationBundle:Trip')->findAll();
     foreach ($members as $member) {
         $participateTrip = new ParticipateTrip();
         $participateTrip->setDateInscription(new \DateTime());
         $participateTrip->setMembers($manager->getRepository('ESNMembersBundle:Member')->find($members[rand(0, count($members) - 1)]));
         $participateTrip->setTrips($manager->getRepository('ESNAdministrationBundle:Trip')->find($trips[rand(0, count($trips) - 1)]));
         $this->manager->persist($participateTrip);
     }
     $this->manager->flush();
 }
 protected function onSuccess(ParticipateTrip $participateTrip)
 {
     $participateTrip->setDateInscription(new \DateTime());
     $operation = new Operation();
     $operation->setDate(new \DateTime());
     $operation->setDescription("New payment for the trip : " . $participateTrip->getTrip()->getName());
     $operation->setLibelle("Payment for a trip");
     $operation->setMontant($participateTrip->getTrip()->getPrice());
     $montant = $this->em->getRepository('ESNTreasuryBundle:Caisse')->getLastCaisse();
     $caisse = new Caisse();
     $caisse->setMontant($montant + $operation->getMontant());
     $this->em->persist($caisse);
     $this->em->persist($operation);
     $this->em->persist($participateTrip);
     $this->em->flush();
 }