public function save($item, $autoUpdate = true)
    {
        $result = null;
        $this->allowSave = true;
        if (isset($this->events[ self::EVENT_ON_BEFORE_SAVE ])) {
            $this->secureEval($this->events[ self::EVENT_ON_BEFORE_SAVE ], array(
                'item' => &$item
            ));
        }
        if ($this->allowSave) {
            $result = $this->getDriver()->save($item, $autoUpdate);
        }

        if (isset($this->events[ self::EVENT_ON_AFTER_SAVE ])) {
            $this->secureEval($this->events[ self::EVENT_ON_AFTER_SAVE ], array(
                'item' => &$item
            ));
        }
        return $result;
    }
public function save($item, $autoUpdate = true)
    {
        $result = null;
        $this->allowSave = true;
        if (isset($this->events[ self::EVENT_ON_BEFORE_SAVE ])) {
            $this->secureEval($this->events[ self::EVENT_ON_BEFORE_SAVE ], array(
                'item' => &$item
            ));
        }
        if ($this->allowSave) {
            $result = $this->getDriver()->save($item, $autoUpdate);
        }

        if (isset($this->events[ self::EVENT_ON_AFTER_SAVE ])) {
            $this->secureEval($this->events[ self::EVENT_ON_AFTER_SAVE ], array(
                'item' => &$item
            ));
        }
        return $result;
    }
public function save ( $ item , $ autoUpdate = true ) { $ result = null ; $ this -> allowSave = true ; if ( isset ( $ this -> events [ self :: EVENT_ON_BEFORE_SAVE ] ) ) { $ this -> secureEval ( $ this -> events [ self :: EVENT_ON_BEFORE_SAVE ] , array ( 'item' => & $ item ) ) ; } if ( $ this -> allowSave ) { $ result = $ this -> getDriver ( ) -> save ( $ item , $ autoUpdate ) ; } if ( isset ( $ this -> events [ self :: EVENT_ON_AFTER_SAVE ] ) ) { $ this -> secureEval ( $ this -> events [ self :: EVENT_ON_AFTER_SAVE ] , array ( 'item' => & $ item ) ) ; } return $ result ; }
Save data item

@param DataItem|array $item Data item
@param bool           $autoUpdate Create item if doesn't exists
@return DataItem
@throws \Exception
Save data item