public function putAction()
    {
        $data = json_decode($this->getRequest()->getRawBody());
        if (!is_array($data)) $data = array($data);

        $ret = array();
        foreach ($data as $d) {
            $s = $this->_getSelect();
            $s->whereId($d->id);
            $row = $this->_model->getRow($s);
            if (!$row) throw new Kwf_Exception_NotFound();

            $this->_validateUpdate((array)$d);
            $this->_validateSave((array)$d);
            $this->_fillRow($row, $d);
            $this->_beforeUpdate($row);
            $this->_beforeSave($row);
            $row->save();
            $this->_afterSave($row, $d);
            $this->_afterUpdate($row, $d);

            $ret[] = $this->_loadDataFromRow($row);
        }
        if (count($ret) == 1) $ret = reset($ret);

        $this->view->data = $ret;
    }
public function putAction()
    {
        $data = json_decode($this->getRequest()->getRawBody());
        if (!is_array($data)) $data = array($data);

        $ret = array();
        foreach ($data as $d) {
            $s = $this->_getSelect();
            $s->whereId($d->id);
            $row = $this->_model->getRow($s);
            if (!$row) throw new Kwf_Exception_NotFound();

            $this->_validateUpdate((array)$d);
            $this->_validateSave((array)$d);
            $this->_fillRow($row, $d);
            $this->_beforeUpdate($row);
            $this->_beforeSave($row);
            $row->save();
            $this->_afterSave($row, $d);
            $this->_afterUpdate($row, $d);

            $ret[] = $this->_loadDataFromRow($row);
        }
        if (count($ret) == 1) $ret = reset($ret);

        $this->view->data = $ret;
    }
public function putAction ( ) { $ data = json_decode ( $ this -> getRequest ( ) -> getRawBody ( ) ) ; if ( ! is_array ( $ data ) ) $ data = array ( $ data ) ; $ ret = array ( ) ; foreach ( $ data as $ d ) { $ s = $ this -> _getSelect ( ) ; $ s -> whereId ( $ d -> id ) ; $ row = $ this -> _model -> getRow ( $ s ) ; if ( ! $ row ) throw new Kwf_Exception_NotFound ( ) ; $ this -> _validateUpdate ( ( array ) $ d ) ; $ this -> _validateSave ( ( array ) $ d ) ; $ this -> _fillRow ( $ row , $ d ) ; $ this -> _beforeUpdate ( $ row ) ; $ this -> _beforeSave ( $ row ) ; $ row -> save ( ) ; $ this -> _afterSave ( $ row , $ d ) ; $ this -> _afterUpdate ( $ row , $ d ) ; $ ret [ ] = $ this -> _loadDataFromRow ( $ row ) ; } if ( count ( $ ret ) == 1 ) $ ret = reset ( $ ret ) ; $ this -> view -> data = $ ret ; }
Handle PUT requests to update a specific resource item
Handle PUT requests to update a specific resource item