Exemplo n.º 1
0
 /**
  * Update customer
  *
  * PUT /api/customers/{id}
  */
 public function putAction()
 {
     $id = $this->Request()->getParam('id');
     $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0);
     $params = $this->Request()->getPost();
     if ($useNumberAsId) {
         $customer = $this->resource->updateByNumber($id, $params);
     } else {
         $customer = $this->resource->update($id, $params);
     }
     $location = $this->apiBaseUrl . 'customers/' . $customer->getId();
     $data = array('id' => $customer->getId(), 'location' => $location);
     $this->View()->assign(array('success' => true, 'data' => $data));
 }
Exemplo n.º 2
0
    /**
     * Update customer
     *
     * PUT /api/customers/{id}
     */
    public function putAction()
    {
        $id = $this->Request()->getParam('id');
        $params = $this->Request()->getPost();

        $customer = $this->resource->update($id, $params);

        $location = $this->apiBaseUrl . 'customers/' . $customer->getId();
        $data = array(
            'id'       => $customer->getId(),
            'location' => $location
        );

        $this->View()->assign(array('success' => true, 'data' => $data));
        $this->Response()->setHeader('Location', $location);
    }