/** * Creates a new waypoint */ public function createAction() { if (!$this->request->isPost()) { return $this->dispatcher->forward(array("controller" => "waypoints", "action" => "index")); } $waypoint = new Waypoints(); $waypoint->id = $this->request->getPost("id"); $waypoint->name = $this->request->getPost("name"); $waypoint->location = $this->request->getPost("location"); $waypoint->latitude = $this->request->getPost("latitude"); $waypoint->longitude = $this->request->getPost("longitude"); $waypoint->deliveryMap = $this->request->getPost("deliveryMap"); $waypoint->serviceTime = $this->request->getPost("serviceTime"); $waypoint->timeWindows = $this->request->getPost("timeWindows"); $waypoint->priority = $this->request->getPost("priority"); $waypoint->status = $this->request->getPost("status"); $waypoint->created = $this->request->getPost("created"); $waypoint->modified = $this->request->getPost("modified"); if (!$waypoint->save()) { foreach ($waypoint->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "waypoints", "action" => "new")); } $this->flash->success("waypoint was created successfully"); return $this->dispatcher->forward(array("controller" => "waypoints", "action" => "index")); }