public function destroy($key = null)
    {
        if (is_null($key)) {
            $this->_dataChanged  = true;
            $mergedData          = array_merge($this->_DATA, $this->_originalDATA);
            $this->_originalDATA = $this->_removeNewKeys($mergedData);
            $this->_DATA         = [];

        } elseif (array_key_exists($key, $this->_DATA)) {
            $this->_dataChanged = true;

            if (!array_key_exists($key, $this->_originalDATA)
                && !array_key_exists($key, $this->_newKeys)
            ) {
                $this->_originalDATA[$key] = $this->_DATA[$key];
            }

            unset ($this->_DATA[$key]);
        }

        return $this;
    }
public function destroy($key = null)
    {
        if (is_null($key)) {
            $this->_dataChanged  = true;
            $mergedData          = array_merge($this->_DATA, $this->_originalDATA);
            $this->_originalDATA = $this->_removeNewKeys($mergedData);
            $this->_DATA         = [];

        } elseif (array_key_exists($key, $this->_DATA)) {
            $this->_dataChanged = true;

            if (!array_key_exists($key, $this->_originalDATA)
                && !array_key_exists($key, $this->_newKeys)
            ) {
                $this->_originalDATA[$key] = $this->_DATA[$key];
            }

            unset ($this->_DATA[$key]);
        }

        return $this;
    }
public function destroy ( $ key = null ) { if ( is_null ( $ key ) ) { $ this -> _dataChanged = true ; $ mergedData = array_merge ( $ this -> _DATA , $ this -> _originalDATA ) ; $ this -> _originalDATA = $ this -> _removeNewKeys ( $ mergedData ) ; $ this -> _DATA = [ ] ; } elseif ( array_key_exists ( $ key , $ this -> _DATA ) ) { $ this -> _dataChanged = true ; if ( ! array_key_exists ( $ key , $ this -> _originalDATA ) && ! array_key_exists ( $ key , $ this -> _newKeys ) ) { $ this -> _originalDATA [ $ key ] = $ this -> _DATA [ $ key ] ; } unset ( $ this -> _DATA [ $ key ] ) ; } return $ this ; }
destroy key entry in object data, or whole keys
automatically set data to original array

@param string|null $key
@return $this
destroy key entry in object data or whole keys automatically set data to original array