Swoole\Record::put PHP Method

put() public method

将关联数组压入object中,赋值给各个字段
public put ( $data ) : void
$data
return void
    function put($data)
    {
        if ($this->_change == self::STATE_INSERT) {
            $this->_change = self::STATE_UPDATE;
            $this->_update = $data;
        } elseif ($this->_change == self::STATE_EMPTY) {
            $this->_change = self::STATE_INSERT;
            $this->_data = $data;
        }
    }

Usage Example

Example #1
0
 public function current()
 {
     $record = new Record(0, $this->db, $this->table, $this->primary);
     $record->put($this->_list[$this->_current_id]);
     $record->_current_id = $this->_list[$this->_current_id][$this->primary];
     return $record;
 }