libs/Db/Type/DataObject.php
public function save($new_key = null)
    {
        $return = true;

        $cn = $this->device->getConnection(\Octris\Db::DB_MASTER);
        $cl = $cn->getCollection($this->collection);

        if (is_null($this->_id) || (!is_null($new_key) && $this->_id !== $new_key)) {
            // insert new object
            if (($return = !!($new_key = $cl->insert($this, $new_key)))) {
                $this->_id = $new_key;
            }
        } else {
            // update object
            $return = $cl->update($this, $this->_id);
        }

        $cn->release();

        return $return;
    }
public function save($new_key = null)
    {
        $return = true;

        $cn = $this->device->getConnection(\Octris\Db::DB_MASTER);
        $cl = $cn->getCollection($this->collection);

        if (is_null($this->_id) || (!is_null($new_key) && $this->_id !== $new_key)) {
            // insert new object
            if (($return = !!($new_key = $cl->insert($this, $new_key)))) {
                $this->_id = $new_key;
            }
        } else {
            // update object
            $return = $cl->update($this, $this->_id);
        }

        $cn->release();

        return $return;
    }
public function save ( $ new_key = null ) { $ return = true ; $ cn = $ this -> device -> getConnection ( \ Octris \ Db :: DB_MASTER ) ; $ cl = $ cn -> getCollection ( $ this -> collection ) ; if ( is_null ( $ this -> _id ) || ( ! is_null ( $ new_key ) && $ this -> _id !== $ new_key ) ) { // insert new object if ( ( $ return = ! ! ( $ new_key = $ cl -> insert ( $ this , $ new_key ) ) ) ) { $ this -> _id = $ new_key ; } } else { // update object $ return = $ cl -> update ( $ this , $ this -> _id ) ; } $ cn -> release ( ) ; return $ return ; }
Save dataobject to bucket.

@param   string              $new_key        Force inserting with the specified key. The method will fall back to an update,
if the specified key and the object internal key are identically.
@return  bool                                Returns true on success otherwise false.
Save dataobject to bucket .