Beispiel #1
0
 /**
  * Update variant
  *
  * PUT /api/variants/{id}
  */
 public function putAction()
 {
     $id = $this->Request()->getParam('id');
     $params = $this->Request()->getPost();
     $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0);
     if ($useNumberAsId) {
         $article = $this->resource->updateByNumber($id, $params);
     } else {
         $article = $this->resource->update($id, $params);
     }
     $location = $this->apiBaseUrl . 'variants/' . $article->getId();
     $data = ['id' => $article->getId(), 'location' => $location];
     $this->View()->assign(['success' => true, 'data' => $data]);
 }