设置记录的某个字段值
支持使用数据库字段和方法
@access public
@param string|array $field 字段名
@param mixed        $value 字段值
@return integer
964212
public function setField($field, $value = '')
    {
        $condition = !empty($this->options['where']) ? $this->options['where'] : [];

        if (empty($condition)) {
            // 没有条件不做任何更新
            throw new Exception('no data to update');
        }

        if (is_array($field)) {
            $data = $field;
        } else {
            $data[$field] = $value;
        }

        return $this->update($data);
    }
1346953
public function value($field) {
        $this->fields = [];
        $this->order("");
        $this->fields($field);
        $this->limit(0, 1);
        $connection = Pool::get(Connection::class);
        try {
            $value = $connection->value($this->getSql(), $this->whereParams(), $this->cache);
            Pool::release($connection);
            return $value;
        } catch (\RuntimeException $e) {
            Pool::release($connection);
            throw $e;
        } catch (\Error $e) {
            Pool::release($connection);
            throw $e;
        }
    }
634327
protected function validateInteger($field, $value, $params)
    {
        if (isset($params[0]) && (bool) $params[0]) {
            //strict mode
            return preg_match('/^(\d|-[1-9]|-?[1-9]\d*)$/i', $value);
        }

        return \filter_var($value, \FILTER_VALIDATE_INT) !== false;
    }
835710
protected function validateNumber($value, ValidationField $field) {
        $result = filter_var($value, FILTER_VALIDATE_FLOAT);
        if ($result === false) {
            $field->addTypeError($value, 'number');
            return Invalid::value();
        }

        $result = $this->validateNumberProperties($result, $field);

        return $result;
    }
47129
public function in($field, $value) {
        $this->add($field, Expr::IN, (array) $value);

        return $this;
    }
1240928
protected function setAsInteger($field, $value)
    {
        if (in_array($field, $this->getColumns()) && (
                !array_key_exists($field, $this->object) ||
                $this->object[$field] !== $value
        )) {
            $this->dirtyFields[$field] = true;
        }
        $this->object[$field] = (int) $value;

        return $this;
    }
346017
public function fieldValue($field, $value)
    {
        if (!in_array($field, $this->supports)) {
            $this->supports[ ] = $field;
        }
        $this->values[ $field ] = $value;

        return $this;
    }
1050958
protected function getFieldValue(string $field, string $value): array
    {
        return [
            'type' => $this->searchFields[$field]['type'],
            'operator' => key($this->searchFields[$field]['operators']),
            'value' => $value
        ];
    }
146820
public function contains($field, $value)
    {
        return function ($object) use ($field, $value) {
            return false !== strpos(ClosureExpressionBuilder::getObjectFieldValue($object, $field), $value);
        };
    }
591791
public function findBy($field, $value)
    {
        $model_class = $this->getModelName();
        return $model_class::where($field, $value)->first();
    }
48128
protected function _cast($field, $value)
  {
    switch($field)
    {
      case '_id':
        // Cast _id strings to MongoIds if they convert back and forth without changing
        if ($value instanceof MongoId)
          return $value;
        if ((is_string($value) || ctype_xdigit($value) || (is_object($value) && method_exists($value, '__toString'))) && strlen($value) == 24)
        {
          $id = new MongoId($value);
          if( (string) $id == $value)
            return $id;
        }
    }
    return $value;
  }
334004
public function get($value, $field = '*', $name = 'id')
    {
        $map = array(
            $name => $value
        );
        return $this->where($map)
            ->field($field)
            ->find();
    }
261205
public function set($field, $value = null)
    {
        if (! is_array($field)) {
            $field = [$field => $value];
        }

        foreach ($field as $f => $v) {
            $this->update('$set', $f, $v);
        }

        return $this;
    }
306776
protected function updateSetting($field, $value)
    {
        $value = is_array($value) ? json_encode($value) : $value;

        return $this->getTableObject()
            ->where('id', $field)
            ->update(['value' => $value]);
    }
969729
public function where($field, $value)
    {
        if (!isset($this->_expression[$field]) || !is_array($value) || !is_array($this->_expression[$field])) {
            $this->_expression[$field] = $value;
        } else {
            $this->_expression[$field] = array_merge_recursive($this->_expression[$field], $value);
        }

        return $this;
    }
1209084
public function setFieldValue($object, $field, $value)
    {
        $this->assertObjectInstance($object);

        return $this->getField($field)->set($object, $value);
    }
294543
public function lookAt($value, $field)
    {
        $this->value = $value;
        $this->field = $field;
        return $this;

    }