Create a new record and populate it with data.
@param  array An associative array of FileName => Values to populate the record with
@return object This object
772316
public function createRecord($data)
    {
        $this->primeCommandArray();
        $this->addToCommandArray($data);
        $this->addToCommandArray(['-new' => null]);
        return $this;
    }
849048
public static function createFromArray(array $array): self
    {
        if (!isset($array['uuid'], $array['app_id'])) {
            throw InvalidFormatException::indexFormatNotValid();
        }

        return new self(
            IndexUUID::createFromArray($array['uuid']),
            AppUUID::createFromArray($array['app_id']),
            $array['is_ok'] ?? false,
            $array['doc_count'] ?? 0,
            $array['size'] ?? '0kb',
            $array['shards'] ?? Config::DEFAULT_SHARDS,
            $array['replicas'] ?? Config::DEFAULT_REPLICAS,
            $array['fields'] ?? [],
            $array['metadata'] ?? []
        );
    }
198571
public function create_new(array $attributes = array())
    {
        $instance = null;

        if (!$this->is_collection) {
            $instance = new self::$custom_collections[$this->name]();
        } else {
            $instance = new Collection(array('table_name' => $this->name));
        }

        $instance->fill($attributes);

        // Fill '_id' if it's provided and in a trusted context
        if (isset($attributes['_id']) && Context::isTrusted()) {
            $instance->_id = $attributes['_id'];
        }

        return $instance;
    }
1350479
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']                = LanguageUtility::toString($this->action);
        $array['clientId']              = $this->clientId;
        $array['subject']               = $this->subject;
        $array['scopes']                = $this->scopes;
        $array['existent']              = $this->existent;
        $array['usable']                = $this->usable;
        $array['sufficient']            = $this->sufficient;
        $array['refreshable']           = $this->refreshable;
        $array['responseContent']       = $this->responseContent;
        $array['expiresAt']             = $this->expiresAt;
        $array['properties']            = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
        $array['clientIdAlias']         = $this->clientIdAlias;
        $array['clientIdAliasUsed']     = $this->clientIdAliasUsed;
        $array['certificateThumbprint'] = $this->certificateThumbprint;
    }
1112119
public static function createFromArray(array $dataArray): self
    {
        $data = new DataContainer($dataArray);

        $result = new self();
        $result->setId($data->getInteger('id'))
               ->setHash(bin2hex($data->get('hash', '')))
               ->setType($data->getString('type'))
               ->setName($data->getString('name'))
               ->setOrder($data->getInteger('order'));
        return $result;
    }
161952
protected function doCreateObject(array $array)
    {
        $orderItem = new WishListItem($array);
        if (isset($array['products']) && $product = reset($array['products'])) {
            $productMapper = new ProductsMapper();

            if (isset($array['images'])) {
                $product['images'] = $array['images'];
            }

            $orderItem->product = $productMapper->createObject($product);
        }

        return $orderItem;
    }
187710
public function add(array $data = []) : Request
  {
    $this->data = array_merge($this->data, $data);

    $files = array_filter($data, function($file) {
      if (isset($file['type']) && isset($file['name']) && isset($file['size'])) return $file;
    });

    $this->files = array_merge($this->files, $files);
    return $this;
  }
977309
public static function createFromArray(array $array): self
    {
        if (
            !isset($array['uuid']) ||
            !is_array($array['uuid'])
        ) {
            throw InvalidFormatException::itemUUIDRepresentationNotValid($array['uuid'] ?? []);
        }

        if (
            isset($array['coordinate']) &&
            !is_array($array['coordinate'])
        ) {
            throw InvalidFormatException::coordinateFormatNotValid();
        }

        $item = isset($array['coordinate'])
            ? self::createLocated(
                ItemUUID::createFromArray($array['uuid']),
                Coordinate::createFromArray($array['coordinate']),
                $array['metadata'] ?? [],
                $array['indexed_metadata'] ?? [],
                $array['searchable_metadata'] ?? [],
                $array['exact_matching_metadata'] ?? [],
                $array['suggest'] ?? []
            )
            : self::create(
                ItemUUID::createFromArray($array['uuid']),
                $array['metadata'] ?? [],
                $array['indexed_metadata'] ?? [],
                $array['searchable_metadata'] ?? [],
                $array['exact_matching_metadata'] ?? [],
                $array['suggest'] ?? []
            );

        if (isset($array['distance'])) {
            $item->distance = (float) $array['distance'];
        }

        if (isset($array['highlights'])) {
            $item->highlights = $array['highlights'];
        }

        if (isset($array['is_promoted']) && true === $array['is_promoted']) {
            $item->setPromoted();
        }

        if (isset($array['score']) && !is_null($array['score'])) {
            $item->setScore((float) $array['score']);
        }

        return $item;
    }
838832
public function loadFromArray(array $array)
    {
        if (isset($array['filename'])) {
            $this->filename = $array['filename'];
        }

        if (isset($array['size'])) {
            $this->size = $array['size'];
        }

        if (isset($array['type'])) {
            $this->type = $array['type'];
        }

        if (isset($array['cid'])) {
            $this->cid = $array['cid'];
        }

        if (isset($array['href'])) {
            $this->href = $array['href'];
        }

        return $this;
    }
673869
public static function createFromArray(array $array): self
    {
        if (empty($array['name'])) {
            throw InvalidFormatException::queryFormatNotValid($array);
        }

        return self::create(
            $array['name'],
            $array['field'] ?? 'uuid.type',
            (int) ($array['application_type'] ?? Filter::AT_LEAST_ONE),
            $array['filter_type'] ?? Filter::TYPE_FIELD,
            $array['subgroup'] ?? [],
            $array['sort'] ?? self::SORT_BY_COUNT_DESC,
            $array['limit'] ?? self::NO_LIMIT
        );
    }
406070
public function fillFromArray(array $array)
    {
        $this->resetCollection();
        foreach ($array as $one_array) {

            // Important to have every time new Object,
            // !!! Not copy of last existing version with values
            $instance = clone $this->getInstance();

            // make reset attributes
            if ($instance instanceof \Phunc\CollectionInstanceInterface) {
                $instance->reset();
            }

            $this->add(
                $instance->fillFromArray($one_array)
            );
        }
        return $this;
    }
1076077
public static function create($_)
    {
        if (func_num_args() < 1) {
            return static::createFromArray([]);
        }

        $arguments = func_get_args();

        if (is_array($arguments[0]) && func_num_args() === 1) {
            return static::createFromArray($arguments[0]);
        }

        return static::createFromFile($arguments);
    }
592049
function copy() {
		$new_object = new static();
		$values = $this->toArray();

		foreach (static::$_primaryKeys as $pk) {
			unset($values[$pk]);
		}

		$new_object->fromArray($values);
		return $new_object;
	}
470933
public static function createFromArray(array $array): self
    {
        $activeElements = [];
        foreach (($array['active_elements'] ?? []) as $activeElement) {
            $activeElements[] = is_array($activeElement)
                ? Counter::createFromArray($activeElement)
                : $activeElement;
        }

        $aggregation = new self(
            $array['name'],
            (int) ($array['application_type'] ?? Filter::AT_LEAST_ONE),
            (int) ($array['total_elements'] ?? 0),
            []
        );
        $aggregation->activeElements = $activeElements;
        $counters = array_map(function (array $counter) {
            return Counter::createFromArray($counter);
        }, $array['counters'] ?? []);
        foreach ($counters as $counter) {
            $aggregation->counters[$counter->getId()] = $counter;
        }

        $aggregation->highestActiveLevel = $array['highest_active_level'] ?? 0;

        return $aggregation;
    }
675032
protected function fromArray($array)
    {
        if (empty($array)) {
            return $this;
        }

        $this->query = new QueryString();

        if (!empty($array['query'])) {
            $this->query->import($array['query']);
        }

        $keys = array(
            'scheme',
            'host',
            'port',
            'user',
            'pass',
            'path',
            'fragment',
            'dirname',
            'basename',
            'extension',
            'filename',
        );

        foreach ($keys as $key) {
            if (!isset($array[$key])) {
                continue;
            }

            $this->$key = $array[$key];

            if ($key === 'path') {
                $this->parsePath($this->path);
            }
        }

        $this->buildPath();

        return $this;
    }
730150
protected function doCreateObject(array $array)
    {
        $raw = [];
        foreach ($array as $item) {
            $raw[$item['attributeId']]['id']               = $item['attributeId'];
            $raw[$item['attributeId']]['title']            = $item['title'];
            $raw[$item['attributeId']]['code']             = $item['code'];
            $raw[$item['attributeId']]['cssClass']         = $item['cssClass'];
            $raw[$item['attributeId']]['orderNumber']      = $item['orderNumber'];
            $raw[$item['attributeId']]['showInSpecList']   = $item['showInSpecList'];
            $raw[$item['attributeId']]['useInFilter']      = $item['useInFilter'];
            $raw[$item['attributeId']]['description']      = $item['description'];
            $raw[$item['attributeId']]['attributeGroupId'] = $item['attributeGroupId'];
            $raw[$item['attributeId']]['displayType']      = $item['displayType'];

            $raw[$item['attributeId']]['attributeValues'][] = [
                'id'     => $item['id'],
                'value'  => $item['value'],
                'cssClass' => $item['cssClass'],
                'title'  => $item['valueTitle'],
                'amount' => $item['amount'],
                'orderNumber' => $item['orderNumberAttributeValues'] ?? null
            ];
        }

        $mapper = new AttributesMapper();
        $result = [];
        foreach ($raw as $item) {
            $result[] = $mapper->createObject($item);
        }

        return $result;
    }
561922
private function loadByData(): Record
    {
        $this->_loaded = true;
        $this->_data = $this->_table->row('*', self::dataForWrite())->toArray();
        return $this;
    }