Set multiple fields
@param array
@return integer Number of fields assigned
547646
public function assign($vals)
    {
        if (count($vals) === 0) {
            return 0;
        }

        $n = 0;
        foreach ($vals as $k => $v) {
            if ($this->set($k, $v)) {
                $n++;
            }
        }

        return $n;
    }
1230634
public R setFields(String... fields) {
        if (fields.length == 1 && fields[0] == null){
            mQueryMap.remove(QUERY_FIELDS);
            return (R) this;
        }
        if (fields.length > 0) {
            StringBuilder sb = new StringBuilder();
            sb.append(fields[0]);
            for (int i = 1; i < fields.length; ++i) {
                sb.append(String.format(Locale.ENGLISH, ",%s", fields[i]));
            }
            mQueryMap.put(QUERY_FIELDS, sb.toString());
        }

        return (R) this;
    }
1246422
public function setFields($fields)
    {
        if ($fields instanceof RecordFields) {
            $this->fields = $fields;
        } else {
            if (is_array($fields)) {
                $fields       = new RecordFields($fields);
                $this->fields = $fields;
            }
        }
        return $this;
    }
1015825
public function setFields(array $fields)
    {
        foreach ($fields as $field => $value) {
            if (property_exists($this, $field)) {
                $this->{$field} = $value;
            }
        }

        if (isset($fields['_embedded'])) {
            foreach ($fields['_embedded'] as $embeddedType => $embeddedValue) {
                if (property_exists($this, $embeddedType)) {
                    $propertyObject = $this->factory->createFromPropertyName($embeddedType);
                    if ($propertyObject === null) {
                        continue;
                    }

                    if (is_array($propertyObject)) { //Property is a collection
                        foreach ($embeddedValue as $entityType => $entityFields) {
                            $entityObject = $this->factory->createFromPropertyName($entityType);
                            if ($entityObject === null) {
                                continue;
                            }

                            $entityObject->setFields($entityFields);

                            $propertyObject[] = $entityObject;
                        }
                    } else { //Property is an entity
                        $propertyObject->setFields($embeddedValue);
                    }

                    $this->{$embeddedType} = $propertyObject;
                }
            }
        }
    }
821048
public function setFields(array $fields,array $values)
        {
                $count = count($fields);
                if($count!=count($values)) {
                        throw new \Exception('fields num != values num');
                }
                $params = [];
                for ($i=0; $i<$count; $i++) {
                        $params[] = $fields[$i];
                        $params[] = $values[$i];
                }
                return $this->_redis->hmset($this->_key, $params);
        }
425009
public function setFields($fields)
    {
        $data = @unserialize($fields);
        if ($fields === 'b:0;' || $data !== false) {
            $this->fields = $fields;
        } else {
            $this->fields = serialize($fields);
        }

        return $this;
    }
107078
protected function setArrayOfArraysData()
    {
        $this->setColumnCountViaArray($this->data);

        $new_data = array_fill(0, $this->column_count, []);

        foreach ($this->data as $items) {
            for ($i = 0; $i < $this->column_count; $i++) {
                $new_data[$i][] = (array_key_exists($i, $items)) ? $items[$i] : null;
            }
        }

        return $new_data;
    }
70242
public function setParams(array $array)
        {
            $this->_params = $this->_params + (array) $array;

            foreach ($array as $key => $value) {
                if (null === $value) {
                    unset($this->_params[$key]);
                }
            }

            return $this;
        }
906949
public function set_fields($fields, $output) {
        $this->fields = $fields;
        $this->head = array();
        $this->colclasses = array();
        $this->align = array();
        $url = $this->manager->get_moodlepage()->url;

        if (!empty($this->bulkoperations)) {
            // If there are bulk operations add a column for checkboxes.
            $this->head[] = '';
            $this->colclasses[] = 'field col_bulkops';
        }

        foreach ($fields as $name => $label) {
            $newlabel = '';
            if (is_array($label)) {
                $bits = array();
                foreach ($label as $n => $l) {
                    if ($l === false) {
                        continue;
                    }
                    if (!in_array($n, self::$sortablefields)) {
                        $bits[] = $l;
                    } else {
                        $sorturl = new moodle_url($url, array(self::SORTVAR => $n, self::SORTDIRECTIONVAR => $this->get_field_sort_direction($n)));
                        $link = html_writer::link($sorturl, $fields[$name][$n]);
                        if ($this->sort == $n) {
                            $link .= $this->get_direction_icon($output, $n);
                        }
                        $bits[] = html_writer::tag('span', $link, array('class'=>'subheading_'.$n));

                    }
                }
                $newlabel = join(' / ', $bits);
            } else {
                if (!in_array($name, self::$sortablefields)) {
                    $newlabel = $label;
                } else {
                    $sorturl = new moodle_url($url, array(self::SORTVAR => $name, self::SORTDIRECTIONVAR => $this->get_field_sort_direction($name)));
                    $newlabel  = html_writer::link($sorturl, $fields[$name]);
                    if ($this->sort == $name) {
                        $newlabel .= $this->get_direction_icon($output, $name);
                    }
                }
            }
            $this->head[] = $newlabel;
            $this->colclasses[] = 'field col_'.$name;
        }
    }
43059
public function setFields(array $fields)
    {
        $this->checkValidLoader();

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

        return $this;
    }
632798
public function setFields( $fields )
	{
		if( is_array( $fields ) && count( $fields ) )
			$this->fields = $fields;
		else
			trigger_error( 'Field Array of Table Definition must no be empty.', E_USER_ERROR );
	}
609513
public function setFields($table, $fields = array("*")){

		//put this in try...catch block for better error handling
		try{

			//check if from is empty
			if ( empty($table)) 
			{
				//throw new exception
				throw new MySQLException("Invalid argument passed for table name", 1);

			}

		}

		//diplay error message
		catch(MySQLException $MySQLExceptionObject){

			//display error message
			$MySQLExceptionObject->errorShow();

		}		

		//check if fields is sset and set the fields param
		$this->froms = $table;
		$this->fields[$table] = $fields;
	}
1131492
public function setMultiple(array $multiple)
    {
        $this->multiple = $multiple;

        if(count($this->multiple) > 0) {
            if(!in_array(0, $this->notFilterableFields)) {
                $this->notFilterableFields[] = 0;
            }
            if(!in_array(0, $this->notSortableFields)) {
                $this->notSortableFields[] = 0;
            }
        }

        return $this;
    }
1181256
private function _setFields($object, $fields)
    {
        $fields = is_array($fields) ? $fields : [];
        foreach ($fields as $sKey => $sValue) {
            $object->$sKey = oxNew('oxField', $sValue);
        }

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

        return $this->setParam('fields', (string) $fields);
    }
263051
protected function setFields()
    {
        $this->set = new \stdClass();
        $schema    = $this->schema();

        foreach ($schema as $field => $type)
        {
            if (Helpers\Validate::isNumeric($type) && $field != 'id')
            {
                $this->setField($field, 0);
            }
            else
            {
                $this->setField($field, null);
            }
        }
    }
598246
protected function setPostFields (array $fields)
	{
		foreach ($fields as $key => $value) $this->fields[$key] = $value;
	}