Handles the saving of the platform scheme
@param $data
@param $id
@param bool $setAsActive
@return mixed
514538
public function saveScheme($data, $id, $setAsActive = false)
    {
        // Event parameters prepare
        $arrayParameters = $this->makeArrayFromParameters(__METHOD__, func_get_args());
        $results = false;

        // Sending service start event
        $arrayParameters = $this->sendEvent('melis_core_package_scheme_save_start', $arrayParameters);

        $data        = $arrayParameters['data'];
        $id          = (int)  $arrayParameters['id'];
        $setAsActive = (bool) $arrayParameters['setAsActive'];

        $success     = $this->schemeTable()->save(array_merge($data, array('pscheme_is_active' => $setAsActive)), $id);

        if($success) {
            $results = true;
        }

        // Adding results to parameters for events treatment if needed
        $arrayParameters['results'] = $results;
        // Sending service end event
        $arrayParameters = $this->sendEvent('melis_core_package_scheme_save_end', $arrayParameters);

        return $arrayParameters['results'];
    }
938811
public function setEnabled($id, $enabled = true)
    {
        if (!$user = $this->getUser($id)) {
            return false;
        }

        $user['enabled'] = (int) $enabled;

        return $this->saveUser($user);
    }
254688
public function write($id, $data)
    {
        $session = \Doctrine::getTable($this->_tableName)->find($id);
        if (false === $session) {
            $session = new $this->_tableName();
            $session->{$this->_primaryKeyColumn} = $id;
        }

        $session->{$this->_dataColumn} = $data;
        $session->{$this->_lifetimeColumn} = $this->_lifetime;
        $session->{$this->_modifiedColumn} = time();

        if ($session->save()) {
            return true;
        }

        return false;
    }
338397
public function update($id, array $data)
    {
        $todolist = $this->client->put(
            sprintf('buckets/%d/todolists/%d.json', $this->bucket, $id),
            [
                'json' => $data,
            ]
        );

        return new TodoList($this->response($todolist));
    }
787256
public function save( $id, $data, $ttl = 0 ) {
		$this->cache->save( $id, $data, $ttl );
	}
502460
function save( $id, $data )
    {
        $data['__meta']['sid'] = $this->sid;

        $params = [
            'index' => $this->config->index,
            'type' => $this->config->type,
            'id' => $id,
            'body' => $data,
        ];

        $this->client->index($params);
    }
1135662
public function set($id, $data, $lifetime = 0) {
		if ($lifetime === 0) {
			$expire = '0000000000';
		} else {
			$expire = time() + $lifetime;
		}
		
		$options = 0;
		
		if (! is_string($data)) {
			$data = serialize($data);
			$options += self::OPTION_SERIALIZED;
		}
		
		if ($this->compression
		&& ($this->compressionTreshold === 0
		|| ($this->compressionTreshold > 0 && strlen($data) > $this->compressionTreshold))) {
			$data = gzcompress($data, $this->compressionLevel);
			$options += self::OPTION_COMPRESSED;
		}
		
		$options = sprintf('%03d', $options);
		$path    = $this->preparePath($id);
		$content = $expire . ';' . $options . ';' . $data;
		
		$result = file_put_contents($path, $content, LOCK_EX);
		
		if ($result === false) {
			throw new OperationFailed('Unable to puth the cache content to: ' . $path);
		}
		
		return true;
	}
1314026
public function save(string $id, array $data)
    {
        $this->setFile($id);
        if ($this->file) {
            if (file_exists($this->file)) {
                $this->update($id, $data);
            } else {
                $this->add($id, $data);
            }
        }
    }
573386
public function store($id, $data = array())
    {
        $data = array_merge(
            [self::DIAGNOSTIC_ID => $id],
            $data
        );

        $data = $this->cleanInputData($data);

        $this->openFile();
        $this->update($id, $data);

        return $this;
    }
1360719
public function update($id, $data)
    {
        $siteId = $this->getRequestSiteId();

        //ACCESS CHECK
        $sitePagesResource = $this->getSitePagesResourceId($siteId);
        if (!$this->isAllowed('pages', 'edit')
            && !$this->isAllowed(
                $sitePagesResource,
                'edit'
            )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        $inputFilter = new SitePageUpdateInputFilter();

        $inputFilter->setData($data);

        if (!$inputFilter->isValid()) {
            return new ApiJsonModel(
                [],
                1,
                'Some values are missing or invalid for page update.',
                $inputFilter->getMessages()
            );
        }

        $data = $inputFilter->getValues();

        // <tracking>
        $data['modifiedByUserId'] = $this->getCurrentUserId();
        $data['modifiedReason'] = 'Update site in ' . get_class($this);

        $site = $this->getSite($siteId);

        if (empty($site)) {
            return new ApiJsonModel(
                null,
                1,
                "Site was not found with id {$siteId}."
            );
        }

        $page = $this->getPage($site, $id);

        $this->pageMutationService->updatePublishedVersionOfPage($this->getCurrentUser(), $page, $data);

        $apiResponse = new SitePageApiResponse($page);

        return new ApiJsonModel($apiResponse, 0, 'Success: Page updated.');
    }
146838
public function update($data, $id) {

		$bean = \R::findOne( $this->type, ' id = :id ', [ ':id' => $id ] );
		if ( !$bean ) {
			throw new \Exception('This '.$this->type.' does not exist.');
		}
		return $this->set($data, $bean);

	}
1000123
public function write($id, $data)
    {
        $access = time();
        $this->session_id = (string) $id;
        $this->access = $access;
        $this->data = $data;
        $this->save();

        return true;
    }
577400
public function setActive($id)
	{
		if (isset($this->_items[$id]))
		{
			$this->_active = $id;

			$result =& $this->_items[$id];

			return $result;
		}

		return null;
	}
329671
public function editPermission(array $data = [], $id = null)
    {
        if (!empty($id)) {
            $data['id'] = $id;
        }
        try{
            return $this->createPermission($data);
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
    }
752811
public function update(array $data, $id)
    {
        $this->sqlBuilder->addWhere($this->primaryKey, $id);
        return $this->updates($data);
    }
1166206
protected function doSave($id, $data, $lifeTime = false)
    {
        if (!$lifeTime) {
            $this->cache->forever($id, $data);
        } else {
            $this->cache->put($id, $data, $lifeTime);
        }

        return true;
    }
667209
public function save($id, $data, $lifeTime = 0)
    {
        $item = $this->cache->getItem((string) $id);
        $item->set($data);

        if ($lifeTime > 0) {
            $item->expiresAfter($lifeTime);
        }

        return $this->cache->save($item);
    }