コード例 #1
0
 public function __construct(ActiveTableOrder $activeTableOrder)
 {
     $this->id = $activeTableOrder->getId();
     if (!is_null($activeTableOrder->getReserveDate())) {
         $this->date = $activeTableOrder->getReserveDate()->format('Y/m/d');
     }
     if (!is_null($activeTableOrder->getReserveTime())) {
         $this->time = $activeTableOrder->getReserveTime()->format('H:i:s');
     }
     $this->name = $activeTableOrder->getRestaurant()->getName();
     $this->address = $activeTableOrder->getRestaurant()->getCity() . ", " . $activeTableOrder->getRestaurant()->getStreet() . ", " . $activeTableOrder->getRestaurant()->getHouse();
     $this->rating = $activeTableOrder->getRestaurant()->getRating();
     $this->restaurantId = $activeTableOrder->getRestaurant()->getId();
 }
コード例 #2
0
 /**
  * Send reject order notifiction to admin
  * 
  * @param Table\RestaurantBundle\Entity\ActiveTableOrder $activeTableOrder
  */
 public function sendRejectTableOrderNotification4admin($activeTableOrder)
 {
     // get User Mail
     // get subject
     $container = $this->getConfigurationPool()->getContainer();
     $trans = $container->get('translator');
     $subject = $trans->trans('main.mail.tableOrder.notification.reject.subject', array(), 'ApplicationSonataAdminBundle');
     // get admin email
     $adminEmail = $activeTableOrder->getRestaurant()->getEmail();
     // sent email
     // add logo
     $logo = $container->getParameter('site_url') . 'uploads/t4ylogo.png';
     $message = \Swift_Message::newInstance()->setSubject($subject)->setFrom($container->getParameter('mailer_user'))->setTo($adminEmail)->setBody($container->get('templating')->render('TableMainBundle:Mail:rejectTableOrderNotification4admin.html.twig', array('tableOrder' => $activeTableOrder, 'logo' => $logo)), 'text/html', 'utf-8');
     $container->get('mailer')->send($message);
     // sent sms
     // get target email regarding phone number
     if (!is_null($phone = $activeTableOrder->getRestaurant()->getPhone())) {
         // get sms text
         $text = $container->get('templating')->render('TableMainBundle:Mail:rejectTableOrderSMS4admin.html.twig', array('tableOrder' => $activeTableOrder));
         // send sms
         $response = $container->get('sms_manager')->sendMessage($phone, $text);
     }
 }