/** * Update order * * PUT /api/orders/{id} */ public function putAction() { $id = $this->Request()->getParam('id'); $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0); $params = $this->Request()->getPost(); if ($useNumberAsId) { $order = $this->resource->updateByNumber($id, $params); } else { $order = $this->resource->update($id, $params); } $location = $this->apiBaseUrl . 'orders/' . $order->getId(); $data = array('id' => $order->getId(), 'location' => $location); $this->View()->assign(array('success' => true, 'data' => $data)); }
/** * Update order * * PUT /api/orders/{id} */ public function putAction() { $id = $this->Request()->getParam('id'); $params = $this->Request()->getPost(); $order = $this->resource->update($id, $params); $location = $this->apiBaseUrl . 'orders/' . $order->getId(); $data = array( 'id' => $order->getId(), 'location' => $location ); $this->View()->assign(array('success' => true, 'data' => $data)); $this->Response()->setHeader('Location', $location); }