Persist data in database.

@param  DataAbstract $data
@return bool
165411
public function persist(DataAbstract $data)
    {
        if ($data->exists()) {
            return $this->update($data);
        } else {
            return $this->insert($data);
        }
    }
683161
public function save(array $data = []) : bool
    {
        $this->fill($data);
        $result = null;

        if ($this->exists()) {
            $result = $this->update();
        } else {
            $result = $this->insert();
        }

        return $result->count() > 0;
    }
894845
public function save($data)
    {
        if (!isset($data[$this->primaryKey])) {
            $data[$this->primaryKey] = 0;
        }

        try {
            if (0 === $data[$this->primaryKey]) {
                unset($data[$this->primaryKey]);

                $id = $this->insert($data);
            } else {
                if ($this->find($data[$this->primaryKey], true)) {
                    $this->update($data);
                } else {
                    $this->insert($data);
                }

                $id = $data[$this->primaryKey];
            }
        } catch(\Exception $e) {
            return [
                'code' => $e->getCode(),
                'message' => $e->getMessage()
            ];
        }

        return $id;
    }
359252
public function save(array $data)
    {
        // This is what we're going to store
        $seriaziledData = $this->serializer->serialize($data);
        $this->storageAdapter->set($this->key, $seriaziledData, $this->ttl);

        return true;
    }
1068338
public function write($id, $data)
    {
        $return = false;

        $data = array($this->_modifiedColumn => time(),
                      $this->_dataColumn     => (string) $data);

        $rows = call_user_func_array(array(&$this, 'find'), $this->_getPrimary($id));

        if (count($rows)) {
            $data[$this->_lifetimeColumn] = $this->_getLifetime($rows->current());

            if ($this->update($data, $this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) {
                $return = true;
            }
        } else {
            $data[$this->_lifetimeColumn] = $this->_lifetime;

            if ($this->insert(array_merge($this->_getPrimary($id, self::PRIMARY_TYPE_ASSOC), $data))) {
                $return = true;
            }
        }

        return $return;
    }
769502
public function set(Data $data)
    {
        $class = get_class($data);
        if (!$this->isEnabled()) {
            return false;
        }

        if ($data->isFresh()) {
            return false;
        }

        if (!$id = $data->id(true)) {
            return false;
        }

        $key = self::key($class, $id);
        $this->members[$key] = $data;
    }
1077058
public function persist($data, $type) {
        if (strtolower($type) == "create") return $this->repository->createRecord($data);

        if (strtolower($type) == "update") return $this->repository->updateRecord($data);

        if (strtolower($type) == "destroy") return $this->repository->destroyRecord($data);
    }
421888
public function put($data)
    {
        if (empty($data) or !is_array($data))
        {
            return false;
        }
        if ($this->db->insert($data, $this->table))
        {
            $lastInsertId = $this->db->lastInsertId();
            if ($lastInsertId == 0)
            {
                return true;
            }
            else
            {
                return $lastInsertId;
            }
        }
        else
        {
            return false;
        }
    }
1143044
public function setDataObject($data)
    {
        if (true === is_object($data)) {
            $data = json_encode($data);
        }

        return $this->setData($data);
    }
456228
public function filter_data_for_persistent($data) {
        $data = parent::filter_data_for_persistent($data);

        $classname = static::$persistentclass;
        $properties = $classname::properties_definition();

        $data = (object) array_filter((array) $data, function($value, $key) use ($properties) {
            return isset($properties[$key]);
        }, ARRAY_FILTER_USE_BOTH);

        return $data;
    }
521308
public function runBeforeSave(array &$data)
    {
        $beforeSave = $this->getOption('before_save');

        if (is_callable($beforeSave)) {
            $bs = $beforeSave($data);

            //if a string is returned, assume it's an error and kick it back
            if (is_string($bs)) {
                return $bs;
            }
        }

        return true;
    }
288226
public function saveData()
    {
        $rows = $this->getData();
        if (empty($rows)) {
            return;
        }

        $bulk = true;
        $row = current($rows);
        $c = array_keys($row);
        foreach ($this->getData() as $row) {
            $k = array_keys($row);
            if ($k != $c) {
                $bulk = false;
                break;
            }
        }

        if ($bulk) {
            $this->getAdapter()->bulkinsert($this, $this->getData());
        } else {
            foreach ($this->getData() as $row) {
                $this->getAdapter()->insert($this, $row);
            }
        }
    }
44412
public function _flush($data)
    {
        $id = array_pop($this->_idStack);
        if ($id === null) {
            Zend_Cache::throwException('use of _flush() without a start()');
        }
        if ($this->_extension) {
            $this->save(serialize(array($data, $this->_extension)), $id, $this->_tags);
        } else {
            $this->save($data, $id, $this->_tags);
        }
        return $data;
    }
1118361
public function writeObject($data) {

            foreach($data as $key=>$value) {
                $this->writeString($key);
                $this->writeAmfData($value);
            }
            $this->writeString('');
            $this->stream->writeByte(SabreAMF_AMF0_Const::DT_OBJECTTERM);
            return true;

        }
598049
public function set($key, $data) {
        if ($this->persist) {
            $this->store[$key] = $data;
        }
        return true;
    }
37047
public function write($data) : bool
    {
        $success = false;

        if ($this->isFile() && $this->isWriteable()) {
            $success = file_put_contents($this->realPath, $data) !== false;
        }

        return $success;
    }
999990
public function save()
	{
		$this->db->begin();
		foreach($this->data as $item)
		{
			$this->db->insert($this->tableName,$item);
		}
		$this->db->commit();
		return true;
	}