/** * Update translation * * PUT /api/translations/{id} */ public function putAction() { $useNumberAsId = (bool) $this->Request()->getParam('useNumberAsId', 0); $id = $this->Request()->getParam('id'); $params = $this->Request()->getPost(); if ($useNumberAsId) { $translation = $this->resource->updateByNumber($id, $params); } else { $translation = $this->resource->update($id, $params); } $location = $this->apiBaseUrl . 'translations/' . $translation['id']; $data = array('id' => $translation['id'], 'location' => $location); $this->View()->assign(array('success' => true, 'data' => $data)); }
/** * @expectedException \Shopware\Components\Api\Exception\ParameterMissingException */ public function testUpdateByNumberMissingId() { $data = $this->getDummyData('article'); $this->resource->updateByNumber(null, $data); }