Adds the specified fields to this table.
@param array $fields - an array of DatabaseField objects
422914
public function addFields(array $fields)
    {
        foreach ($fields as $field)
        {
            $name = $field->getName();
            $addFields[$name] = $field; # we key by name to prevent duplicates!
        }
        
        $keysString = "";
        $fieldStrings = array();
        
        foreach ($addFields as $fieldName => $field)
        {
            $fieldStrings[] = $field->getFieldString();
                
            /* @var $field DatabaseField */
            if ($field->isPrimaryKey())
            {
                $errMsg = 'Do not set field to be primary key when adding fields. ' .
                          'Instead, use the changePrimaryKey method';
                throw new \Exception($errMsg);
            }
            elseif ($field->isKey())
            {
                if ($keysString !== "")
                {
                    $keysString .= ", ";
                }
                
                if ($field->isUnique())
                {
                    $keysString .= "UNIQUE ";
                }
                
                $keysString .= "KEY (`" . $fieldName . "`) ";
            }
        }
        
        $fieldsString = implode(", ", $fieldStrings);
        
        $fieldsString .= $keysString;
        
        $query = 
            "ALTER TABLE " . 
            "`" . $this->m_name . "` " . 
            "ADD " .
            "(" . $fieldsString . ") ";
        
        $result = $this->m_mysqliConn->query($query);
        
        if ($result !== TRUE)
        {
            throw new \Exception('Error creating table with query: ' . $query);
        }
    }
428052
public function fields($fields)
    {
        if (!is_array($fields)) {
            $fields = func_get_args();
        }

        $this->fields = array_merge($this->fields, $fields);

        return $this;
    }
733454
public function setFields($fields)
    {
        if (\is_array($fields)) {
            $fields = \implode(',', $fields);
        }

        return $this->setParam('fields', (string) $fields);
    }
1024287
public function setFields($fields = [])
    {
        $existingSchema = $this->get();

        $request = [];
        foreach ($fields as $field) {
            $mode = $this->hasField($field['name'], $existingSchema) ? 'replace-field' : 'add-field';
            $request[$mode][] = $field;
        }

        return $this->request($request);
    }
1058681
public function setFromArray(array $fields)
    {
        foreach($fields as $key => $value)
        {
                $this->fields[$key] = $value;
                unset($key);
                unset($value);
        }
    }
440456
protected function setFields($fields)
    {
        if(is_array($fields)) {
            foreach ( $fields as $field ) {
                if ( !in_array($field, $this->fieldsWhitelist) ) {
                    throw new \InvalidArgumentException(sprintf('The field `%s` was not recognized.', $field));
                }
            }
        } elseif($fields === true) {
            $fields = $this->fieldsWhitelist;
        } else {
            throw new \InvalidArgumentException("The argument passed to setFields was invalid");
        }

        $this->setQueryParam('fields', $fields);
    }
430740
protected function setField($values)
    {
        foreach ($values as $name => $field) {
            $this->fields[$name] = $field;
        }
    }
389278
public function addFields(array $fields)
    {
        foreach ($fields as $field) {
            if (!$field instanceof FieldDefinitionInterface) {
                continue;
            }

            $this->addField($field);
        }

        return $this;
    }
1269895
protected function saveOriginalFieldNames(array $fields, string $field): void
	{
		foreach($fields as $expanded)
		{
			$this->originalFieldNames[$expanded] = $field;
		}
	}
836609
public function setActualFields($fields)
    {
        if ($this->owner->model->hasMethod('getActualFields')) {
            $this->importFields($this->owner->model, $fields);
        }
    }
691193
public function includeFields(array $fields)
    {
        foreach ($fields as $fieldName) {
            $this->field($fieldName)->expression(true);
        }

        return $this;
    }
928991
public function add(array $fields)
    {
        foreach ($fields as $field => $normalizer) {
            if (is_array($normalizer)) {
                // 'field' => ['field.path', 'defaultValue']
                if (2 == count($normalizer)) {
                    $this->path($field, $normalizer[ 0 ], $normalizer[ 1 ]);
                } else {
                    throw new GenericException('Array can contain only 2 elements!');
                }
            } // 'field' => '::method'
            elseif (0 === strpos($normalizer, '::')) {
                $method = str_replace('::', '', $normalizer);
                if (is_int($field)) {
                    $field = $method;
                }
                $this->method($field, $method);
            } // 'field' => 'field.path'
            else {
                $this->path($field, $normalizer);
            }
        }

        return $this;
    }
293773
public function addFetchFields($field) {
    if (!is_array($field)) {
      if (!in_array($field, $this->fetches)) {
        $this->fetches[] = $field;
      }
    } else {
      $this->fetches = $field;
    }
  }
113602
public function fields($fields) {
        if (!is_array($fields)) {
            $fields = func_get_args();
        }

        $this->_fields = $fields;

        return $this;
    }
500092
public function addFields($fields = [], $defaults = [])
    {
        foreach ($fields as $field) {
            if (is_string($field)) {
                $this->addField($field, $defaults);
                continue;
            }

            if (is_array($field) && isset($field[0])) {
                $name = $field[0];
                unset($field[0]);
                $this->addField($name, $field);
                continue;
            }
        }

        return $this;
    }
43059
public function setFields(array $fields)
    {
        $this->checkValidLoader();

        // Flatten
        $this->loaders[ $this->contextLoader ] = [];
        $this->addFields($fields);

        return $this;
    }
1348214
protected function addValues($fields)
    {
        $values_array = [];
        foreach ($fields as $values) {
            $values_array[] = '(' . $this->_addValue($values) . ')';
        }

        return implode(',', $values_array);
    }