/** * Form with contact data to current owner * * @return Response|array */ public function addApply() { $data = $this->getRequest()->getSession()->get('order.info'); $device = $this->cast('Mapper\\Device', $data['device']); /* @var $device Device */ $location = $device->getLocation(); /* @var $location Location */ $form = $this->createApplyForm(); if ($form->isValid()) { if ($device->getLocation() == $this->getUser()->getLocation()) { throw new OrderWrongLocationException(); } $entity = new \Entity\Order(); $entity->setOwner($this->getUser()); $entity->setDevice($device); $entity->setState($this->cast('Mapper\\OrderState', 1)); $this->persist($entity); $device->setState($this->cast('Mapper\\DeviceState', 2)); $this->flush(); $response = new Response(); $response->redirect('/order'); $this->getRequest()->getSession()->remove('order.info'); return $response; } return compact('form', 'device', 'location'); }
private function informOwner(Entity\Order $order) { ob_start(); require_once "mailMessages/informOwner.php"; $body = ob_get_clean(); $subject = "A fost plasata comanda " . $order->getOrderNumber() . ' Sa curga banii !'; NeoMail::getInstance()->genericMail($body, $subject, $email); }