예제 #1
0
 public function changeStatusOrderAction(Request $request)
 {
     $orderId = $request->get('orderId');
     $order = $this->getDoctrine()->getRepository('ShopBundle:Order')->find($orderId);
     if (!$order) {
         return new JsonResponse(array('errors' => true));
     }
     $status = $request->get('status');
     if ($status) {
         $em = $this->getDoctrine()->getEntityManager();
         $order->setStatus((int) $status);
         $em->persist($order);
         $em->flush();
         $mailer = $this->get('mailer');
         $message = \Swift_Message::newInstance()->setSubject("Изменен статус заказа {$orderId} в магазине sweet-smoke.org")->setFrom(array('*****@*****.**' => 'SweetSmoke'))->setTo(array('*****@*****.**', $order->getEmail()))->setContentType('text/html')->setBody($this->renderView("@Shop/Messages/change_status_order.html.twig", array('order' => $order, 'status' => OrderStatus::getAsText($order->getStatus()))));
         $mailer->send($message);
     }
     return new JsonResponse(array('errors' => false));
 }
예제 #2
0
파일: Order.php 프로젝트: binser/hookah.dev
 public function getTextStatus()
 {
     return OrderStatus::getAsText($this->getStatus());
 }