update() public method

Update an existing resource
public update ( mixed $id, mixed $data ) : mixed
$id mixed
$data mixed
return mixed
Beispiel #1
0
 public function update($id, $data)
 {
     if (!$this->getOptions()->getRestEnabled()) {
         return parent::update($id, $data);
     }
     $this->getResponse()->getHeaders()->addHeaderLine('Content-Type', 'application/json');
     $item = $this->getItem($id);
     $form = $this->getEditForm();
     $result = array('success' => false);
     if ($this->_editItem($item, $form, $data)) {
         $result['success'] = true;
         $result['item'] = $this->itemToSerializable($item);
     }
     return new JsonModel($result);
 }