根据指定的主键值生成Data实例.

@param string|int|array $id 主键值
@param Data [$data]

@return Data|false
15279
public function find($id, Data $data = null)
    {
        $id = $this->normalizeID($id);
        $registry = Registry::getInstance();

        if (!$data) {
            if ($data = $registry->get($this->class, $id)) {
                return $data;
            }
        }

        if (!$record = $this->doFind($id)) {
            return false;
        }

        $data = $this->pack($record, $data ?: null);
        $registry->set($data);

        return $data;
    }
194127
public function update($id, array $data)
    {
        $project = $this->client->put(sprintf('projects/%d.json', $id), [
            'json' => $data,
        ]);

        return new Project($this->response($project));
    }
1231152
public function saveData($data, $id)
    {
        try {
            $location1 = Worker::where('uid', $data['uid'])->first();;
            $location1->name = isset($data['name']) ? $data['name'] : $location1->name;
            $location1->uid = isset($data['uid']) ? $data['uid'] : $location1->uid;
            $location1->state = isset($data['state']) ? $data['state'] : $location1->state;
            $location1->mobile = isset($data['mobile']) ? $data['mobile'] : $location1->mobile;
            $location1->worker_lat = isset($data['worker_lat']) ? $data['worker_lat'] : $location1->worker_lat;
            $location1->worker_lng = isset($data['worker_lng']) ? $data['worker_lng'] : $location1->worker_lng;
            $location1->full_address = isset($data['full_address']) ? $data['full_address'] : $location1->full_address;
            $location1->geom = new GeomPoint( $location1->worker_lng,$location1->worker_lat);
            return $location1->save();
        } catch (\Exception $e) {
            Log::info('c=WorkerApiRepository f=saveData  msg=' . $e->getMessage());
            return false;
        }



    }
606866
public function write($id, $data)
	{
		$tableName = $this->db->parseField($this->tableName);
		$sessionIDField = $this->db->parseField('session_id');
		$dataField = $this->db->parseField('data');
		$updateTimeField = $this->db->parseField('update_time');
		$result = $this->db->query(<<<SQL
select * from {$tableName} where {$sessionIDField} = %s
SQL
,array($id));
		$updateTime = time();
		if(isset($result['session_id']))
		{
			return $this->db->execute(<<<SQL
update {$tableName} set {$dataField} = %s,{$updateTimeField} = %s where {$sessionIDField} = %s
SQL
,array($data,$updateTime,$id));
		}
		else
		{
			return $this->db->execute(<<<SQL
insert into {$tableName}({$sessionIDField},{$dataField},{$updateTimeField}) values(%s,%s,%s)
SQL
,array($id,$data,$updateTime));
		}
	}
522022
public function update($id, $data)
    {
        $message = $this->client->put(
            sprintf('buckets/%d/messages/%d.json', $this->bucket, $id),
            [
                'json' => $data,
            ]
        );

        return new Message($this->response($message));
    }
294191
public function write($id, $data): bool
    {
        return Proxy\Cache::set($this->prepareId($id), $data, $this->ttl);
    }
1207254
public function write($id, $data)
    {
        return $this->getCache()->save(
            $data, 
            $this->normalizeId($id), 
            array(), 
            \Zend_Session::getOptions('gc_maxlifetime')
        );
    }
1199300
public function write( $id, $data, $next ) {
		$this->_write( $id, $data );

		return $next( $id, $data );
	}
139731
public function getById($id, $data = null)
    {
        $data = $this->includeEverything($data);
        return parent::getById($id, $data);
    }
359743
public function write($id, $data)
	{
		try
		{
			$query = $this->db->getQuery(true);
			$query->update($this->db->quoteName('#__session'))
				->set($this->db->quoteName('data') . ' = ' . $this->db->quote($data))
				->set($this->db->quoteName('time') . ' = ' . $this->db->quote((int) time()))
				->where($this->db->quoteName('session_id') . ' = ' . $this->db->quote($id));

			// Try to update the session data in the database table.
			$this->db->setQuery($query);

			if (!$this->db->execute())
			{
				return false;
			}

			// Since $this->db->execute did not throw an exception the query was successful.
			// Either the data changed, or the data was identical. In either case we are done.

			return true;
		}
		catch (\Exception $e)
		{
			return false;
		}
	}
1098135
public function writeSession($id,$data)
	{
		return $this->_cache->set($this->calculateKey($id),$data,$this->getTimeout());
	}
1184878
public function write($id, $data) : bool
    {
        return (bool)$this->walk(
            'write',
            null,
            [$id, compact('data') + self::$session]
        );
    }
765941
public function update($id, $data)
    {
        $data = $this->retrieveData($data);
        $updateData = [
            'methods'=> implode(',', $data['methods']),
        ];

        $this->table->update($updateData, ['id' => $id]);

        return $data;
    }
854170
public static function recursiveData2XML($data, string $item = 'item', string $id = 'id'): string {
		$xml = $attr = '';
		if (is_array($data)) {
			foreach ($data as $key => $val) {
				if (is_numeric($key)) {
					$id && $attr = " {$id}=\"{$key}\"";
					$key = $item;
				}
				$xml .= "<{$key}{$attr}>";
				$xml .= (is_array($val) || is_object($val)) ? static::recursiveData2XML($val, $item, $id) : $val;
				$xml .= "</{$key}>";
			}
		}
		elseif (is_string($data))
			return $data;
		else throw new EncodeXMLException;
		return $xml;
	}
313915
public function update($id, $data) {
		$dt = $this->getDataTable();
		
		if (! $dt)
			return $this->createResponse($this->getNameManager()->getTableNames(), 401, "Tabels");
		
		return $this->createResponse([], 200, "{$this->getNameManager()->entityName}: No Update");
	}
926457
public function add(string $id, array $data = []): bool
    {
        try {
            $this->setFile($id);
            if ($this->file) {

                if (!file_exists($this->file)) {
                    //Novo
                    if($this->versionamento) {
                        $data['created'] = strtotime("now");
                        $data['updated'] = strtotime("now");
                        parent::deleteVerion($this->file);
                    }

                    $f = fopen($this->file, "w+");
                    fwrite($f, json_encode($data));
                    fclose($f);

                    return true;
                }
            }
            return false;
        } catch (\Exception $e) {
            return false;
        }
    }
752811
public function update(array $data, $id)
    {
        $this->sqlBuilder->addWhere($this->primaryKey, $id);
        return $this->updates($data);
    }