Batch set a given list of attribute values.

@param array $values
339683
public function setValues(array $values)
    {
        foreach ($this->type->getAttributes()->getKeys() as $attribute_name) {
            if (array_key_exists($attribute_name, $values)) {
                $this->setValue($attribute_name, $values[$attribute_name]);
            }
        }

        return $this->isValid();
    }
1254462
protected function addToCommandArray($values)
    {
        foreach ($values as $key => $value) {
            $this->commandArray[$key] = $value;
        }
    }
1374003
public function mergeAll(array $values)
    {
        foreach ($values as $key => $value) {
            $this->merge($key, $value);
        }
    }
1237781
public function setAttempts($values)
    {
        $this->setAttribute('attempts', []);

        foreach ($values as $value) {
            $this->addAttempt($value);
        }

        return $this;
    }
1013088
public function setValues(array $values)
    {
        foreach ($values as $key => $value) {
            if (is_integer($value)) {
                // cast integer values silenty to a double value.
                $values[$key] = $value = (double) $value;
            }
            $this->checkType('double', $value, true);
        }
        parent::setValues($values);
    }
140904
public function setValues(array $values)
    {
        // Since Bolt 1.4, we use 'ownerid' instead of 'username' in the DB tables. If we get an array that has an
        // empty 'ownerid', attempt to set it from the 'username'. In $this->setValue the user will be set, regardless
        // of ownerid is an 'id' or a 'username'.
        if (empty($values['ownerid']) && !empty($values['username'])) {
            $values['ownerid'] = $values['username'];
            unset($values['username']);
        }

        foreach ($values as $key => $value) {
            if ($key !== 'templatefields') {
                $this->setValue($key, $value);
            }
        }

        // If default status is set in contentttype.
        if (empty($this->values['status']) && isset($this->contenttype['default_status'])) {
            $this->values['status'] = $this->contenttype['default_status'];
        }

        $serializedFieldTypes = [
            'embed',
            'geolocation',
            'imagelist',
            'image',
            'file',
            'filelist',
            'video',
            'select',
            'templateselect',
            'checkbox',
            'repeater',
        ];
        // Check if the values need to be unserialized, and pre-processed.
        foreach ($this->values as $key => $value) {
            if ((in_array($this->fieldType($key), $serializedFieldTypes)) || ($key === 'templatefields')) {
                if (!empty($value) && is_string($value) && (substr($value, 0, 2) === 'a:' || $value[0] === '[' || $value[0] === '{')) {
                    try {
                        $unserdata = Lib::smartUnserialize($value);
                    } catch (\Exception $e) {
                        $unserdata = false;
                    }

                    if ($unserdata !== false) {
                        $this->values[$key] = $unserdata;
                    }
                }
            }

            if ($this->fieldType($key) === 'video' && is_array($this->values[$key]) && !empty($this->values[$key]['url'])) {
                $defaultValues = [
                    'html'       => '',
                    'responsive' => '',
                    'width'      => '1',
                    'height'     => '1',
                    'ratio'      => '1',
                ];

                $video = array_replace($defaultValues, $this->values[$key]);

                // update the HTML, according to given width and height
                if (!empty($video['width']) && !empty($video['height'])) {
                    $video['html'] = preg_replace("/width=(['\"])([0-9]+)(['\"])/i", 'width=${1}' . $video['width'] . '${3}', $video['html']);
                    $video['html'] = preg_replace("/height=(['\"])([0-9]+)(['\"])/i", 'height=${1}' . $video['height'] . '${3}', $video['html']);
                }

                $responsiveclass = 'responsive-video';

                // See if it's widescreen or not.
                if (!empty($video['height']) && (((int) $video['width'] / (int) $video['height']) > 1.76)) {
                    $responsiveclass .= ' widescreen';
                }

                if (strpos($video['url'], 'vimeo') !== false) {
                    $responsiveclass .= ' vimeo';
                }

                $video['responsive'] = sprintf('<div class="%s">%s</div>', $responsiveclass, $video['html']);

                // Mark them up as Twig markup.
                $video['html'] = new Markup($video['html'], 'UTF-8');
                $video['responsive'] = new Markup($video['responsive'], 'UTF-8');

                $this->values[$key] = $video;
            }

            if ($this->fieldType($key) === 'repeater' && is_array($this->values[$key]) && !$this->isRootType) {
                $originalMapping = null;
                $originalMapping[$key]['fields'] = $this->contenttype['fields'][$key]['fields'];
                $originalMapping[$key]['type'] = 'repeater';

                $mapping = $this->app['storage.metadata']->getRepeaterMapping($originalMapping);
                $repeater = new RepeatingFieldCollection($this->app['storage'], $mapping);
                $repeater->setName($key);

                foreach ($this->values[$key] as $subValue) {
                    $repeater->addFromArray($subValue);
                }

                $this->values[$key] = $repeater;
            }

            if ($this->fieldType($key) === 'date' || $this->fieldType($key) === 'datetime') {
                if ($this->values[$key] === '') {
                    $this->values[$key] = null;
                }
            }
        }

        // Template fields need to be done last
        // As the template has to have been selected
        if ($this->isRootType) {
            if (empty($values['templatefields'])) {
                $this->setValue('templatefields', []);
            } else {
                $this->setValue('templatefields', $values['templatefields']);
            }
        }
    }
424218
public function setAttributeArray(array $attributes = null)
    {
        if (!is_array($attributes) || empty($attributes)) {
            return;
        }

        foreach ($attributes as $name => $value) {
            $this->setAttribute($name, $value);
        }
    }
862529
public function setValues(array $values)
    {

        foreach ($values as & $value) {
            if (PHP_INT_SIZE == 4 && is_double($value)) {
                //TODO: 32bit - handle this specially?
                $value = $this->castValueToSimpleType('integer', $value);
            }

            $this->checkType('integer', $value, true);
        }

        parent::setValues($values);
    }
451508
public function setFields($values)
    {
        foreach ($values as $field => $value) {
            $this->_setFieldValue($field, $value);
        }
    }
323102
public function setValuesSafe(array $values = [])
    {
        $blacklist = is_array(static::$blacklist) ? static::$blacklist : [static::$primary_key];

        foreach ($values as $key => $value) {
            if (!in_array($key, $blacklist) && isset(self::$column_cache[get_called_class()][$key])) {
                $this->set($key, $values[$key]);
            }
        }
    }
853915
public function setValues(array $values) : CheckboxGroup
    {
        foreach ($this->checkboxes as $checkbox) {
            $checkbox->setChecked(in_array($checkbox->getValue(), $values, true));
        }

        return $this;
    }
374566
public function setFieldValues(array $values)
    {
        foreach ($values as $name => $value) {
            $this->setFieldValue($name, $value);
        }
        return $this;
    }
721564
public function fromArray(array $values)
    {
        foreach ($values as $property => $value) {
            $this->__set($property, $value);
        }
        
        return $this;
    }
469326
public function setAll(array $values)
    {
        $this->filters = array_replace($this->filters, $values);
        $this->syncFilters();
        return $this;
    }
819956
public function setValues($values)
    {
        if (!is_array($values)) {
            $values = preg_split('/,\s*/', $values);
        }
        $this->values = $values;

        return $this;
    }
476566
protected function setForeignKeys(array $values)
    {
        foreach ($values as $key => &$value) {
            if ($this->endsWith($key, '_id') && !is_int($value)) {
                list($table, $label) = $this->parseRecordLabel($value);
                $value = $this->generateKey($label, $table);
            }
        }

        return $values;
    }
1251475
private function addMetadata(array $values)
    {
        foreach ($values as $domain => $keys) {
            foreach ($keys as $key => $value) {
                $this->setMetadata($key, $value, $domain);
            }
        }
    }