public function onBookingCancel(\Club\BookingBundle\Event\FilterBookingEvent $event)
 {
     $booking = $event->getBooking();
     $recipients = $this->getRecipients($booking);
     $this->clubmaster_mailer->setSpool(false)->setSubject($this->translator->trans('Booking cancel'))->setFrom()->setBody($this->templating->render('ClubMailBundle:Template:booking_cancel.html.twig', array('user' => $booking->getUser(), 'booking' => $booking)))->setDecorator($recipients);
     foreach ($recipients as $user) {
         $this->clubmaster_mailer->setTo($user->getEmail())->send();
     }
 }
 public function onBookingConfirm(\Club\BookingBundle\Event\FilterBookingEvent $event)
 {
     $booking = $event->getBooking();
     foreach ($booking->getUsers() as $user) {
         if ($user != $booking->getUser()) {
             $c = new \Club\UserBundle\Entity\Connection();
             $c->setUser($booking->getUser());
             $c->setConnection($user);
             $c->setType('booking');
             $this->em->persist($c);
         }
     }
 }
Example #3
0
 public function onBookingCancel(\Club\BookingBundle\Event\FilterBookingEvent $event)
 {
     $booking = $event->getBooking();
     $log = new \Club\LogBundle\Entity\Log();
     $log->setEvent('onBookingConfirm');
     $log->setSeverity('informational');
     $log->setLogType('booking');
     $log->setLog('Deleted a booking');
     if ($this->security_context->getToken() && $this->security_context->isGranted('IS_AUTHENTICATED_FULLY')) {
         $log->setUser($this->security_context->getToken()->getUser());
     }
     $this->em->persist($log);
     $this->em->flush();
 }