public function store($id, $data = array())
    {
        try {

            if (empty($id)) {
                throw new StorageException('Invalid id parameter.');
            }
            $this->persistence = $this->getPersistence();

            $data = $this->cleanInputData($data);
            if (!$this->exists($id)) {
                $this->insert($id, $data);
            } else {
                $this->update($id, $data);
            }
            return true;

        } catch (\PDOException $e) {
            throw new StorageException($e->getMessage());
        }
    }
public function store($id, $data = array())
    {
        try {

            if (empty($id)) {
                throw new StorageException('Invalid id parameter.');
            }
            $this->persistence = $this->getPersistence();

            $data = $this->cleanInputData($data);
            if (!$this->exists($id)) {
                $this->insert($id, $data);
            } else {
                $this->update($id, $data);
            }
            return true;

        } catch (\PDOException $e) {
            throw new StorageException($e->getMessage());
        }
    }
public function store ( $ id , $ data = array ( ) ) { try { if ( empty ( $ id ) ) { throw new StorageException ( 'Invalid id parameter.' ) ; } $ this -> persistence = $ this -> getPersistence ( ) ; $ data = $ this -> cleanInputData ( $ data ) ; if ( ! $ this -> exists ( $ id ) ) { $ this -> insert ( $ id , $ data ) ; } else { $ this -> update ( $ id , $ data ) ; } return true ; } catch ( \ PDOException $ e ) { throw new StorageException ( $ e -> getMessage ( ) ) ; } }
If record already exists, update it by new values
Else insert new entry
@param $id
@param array $data
@return mixed
@throws StorageException
If record already exists update it by new values Else insert new entry