Populate from an array.

@param array $data

@return AbstractModel
960866
public function exchangeArray(array &$data)
    {
        $hydrator = new ClassMethods();
        $formatted = [];
        if (null !== $this->prefix) {
            $pr = $this->allParent();
            $eq = ($pr === $this->prefix);
            foreach ($data as $key => $value) {
                $fkey = null;
                if (0 === ($tmp = strpos($key, $this->prefix . $this->delimiter))) {
                    $fkey = substr($key, strlen($this->prefix . $this->delimiter));
                } elseif ($eq === false && $tmp !== false && 0 === strpos($key, $pr . $this->delimiter)) {
                    $fkey = substr($key, strlen($pr . $this->delimiter));
                } elseif (0 === ($tmp = strpos($key, $this->prefix . $this->delimiter_opt))) {
                    $fkey = substr($key, strlen($this->prefix . $this->delimiter_opt));
                    if($value === null) {
                        $this->keep = false;
                    }
                } elseif ($eq === false && $tmp !== false && 0 === strpos($key, $pr . $this->delimiter_opt)) {
                    $fkey = substr($key, strlen($pr . $this->delimiter_opt));
                    if($value === null) {
                        $this->keep = false;
                    }
                }
                if (null !== $fkey && $hydrator->canBeHydrated($fkey, $this)) {
                    $formatted[$fkey] = ($value === null) ? new IsNull() : $value;
                    unset($data[$key]);
                }
            }
        }
        if (null === $this->prefix || empty($formatted)) {
            foreach ($data as $key => $value) {
                if ($hydrator->canBeHydrated($key, $this)) {
                    $formatted[$key] = ($value === null) ? new IsNull() : $value;
                    unset($data[$key]);
                }
            }
        }
        if(!empty($formatted) && $this->keep === true) {
            $hydrator->hydrate($formatted, $this);
        }
         
        return $this;
    }
132967
public function bind(array $data)
	{
		if (null === $this->object)
		{
			$this->object = new Object;
		}

		$this->object->bind($data);

		return $this;
	}
1018439
private function fillModel(AbstractModel $model, array $data)
    {
        if (!$data) {
            return $model;
        }

        $reflection = new \ReflectionClass($model);
        foreach($reflection->getProperties() as $property) {
            $property->setAccessible(true);
            $property->setValue($model, $data[$property->getName()]);
            $property->setAccessible(false);
        }

        return $model;
    }
412637
public function populate($data = array())
    {
        if (isset($data['name']) && $data['name'] !== null) {
            $this->name = $data['name'];
        }
        if (isset($data['code']) && $data['code'] !== null) {
            $this->code = $data['code'];
        }
        if (isset($data['phase']) && $data['phase'] !== null) {
            $this->phase = $data['phase'];
        }
        if (isset($data['active']) && $data['active'] !== null) {
            $this->active = $data['active'];
        }
    }
297526
public function setArray(array $data)
    {
        foreach ($data as $name => $value) {
            $this->set($name, $value);
        }
        return $this;
    }
316320
public function populate($data = array())
    {
        if (isset($data['title']) && $data['title'] !== null) {
            $this->title = $data['title'];
        }

        if (isset($data['identifier']) && $data['identifier'] !== null) {
            $this->identifier = $data['identifier'];
        }

        if (isset($data['active']) && $data['active'] !== null) {
            $this->active = $data['active'];
        }

        if (isset($data['picto']) && $data['picto'] !== null) {
            $this->picto = $data['picto'];
        }
    }
303475
public function fill(array $data)
    {
        /* @var Field $field */
        foreach ($this->fields() as $field) {
            $field->fill($data);
        }

        return $this;
    }
190182
public static function fromArray(array $data): self
    {
        $fixed_list = new static();

        $fixed_list->decorated = SplFixedArray::fromArray($data, false);

        return $fixed_list;
    }
913438
private function populateWith(array $data): array
    {
        $newData = [];
        foreach ($data as $row) {
            $tmp = [];
            foreach ($row as $key => $value) {
                if (false !== strpos($key, '__')) {
                    list($prefix, $postfix) = explode('__', $key);
                    if (!isset($tmp[$prefix])) {
                        $tmp[$prefix] = [];
                    }
                    $tmp[$prefix][$postfix] = $value;
                } else {
                    $tmp[$key] = $value;
                }
            }
            $newData[] = $tmp;
        }

        return $newData;
    }
623219
public function fromArray(array $data)
    {
        $map = array(
            'id' => 'setId',
            'name' => 'setName',
            'source_type' => 'setSourceType',
            'status' => 'setStatus',
            'parameters' => 'setParameters',
            'auth' => 'setAuth',
            'resources' => 'setResources',
            'created_at' => 'setCreatedAt',
            'validate' => 'setValidate'
        );

        foreach ($map as $key => $setter) {
            if (isset($data[$key])) {
                $this->$setter($data[$key]);
            }
        }

        return $this;
    }
1017963
public static function fromArray(array $data)
	{
		return new self(
			!empty($data['code'])    ? $data['code']    : null,
			!empty($data['message']) ? $data['message'] : null,
			!empty($data['data'])    ? $data['data']    : null
		);
	}
1062012
public function populate($data)
    {
        if (is_null($data)) {
            return $this;
        }

        $data = $this->normalizeData($data);

        $fromDb = false;
        if ($this->isDbData($data)) {
            $fromDb = true;
        } else {
            unset($data['id']);
            unset($data['_id']);
        }

        $validation = $this->arr();

        /* @var $entityAttribute AbstractAttribute */
        foreach ($this->attributes as $attributeName => $entityAttribute) {
            if (!$entityAttribute->getAfterPopulate()) {
                $this->populateAttribute($attributeName, $entityAttribute, $validation, $data, $fromDb);
            }
        }

        foreach ($this->attributes as $attributeName => $entityAttribute) {
            if ($entityAttribute->getAfterPopulate()) {
                $this->populateAttribute($attributeName, $entityAttribute, $validation, $data, $fromDb);
            }
        }

        if ($validation->count() > 0) {
            $attributes = [];
            foreach ($validation as $attr => $error) {
                foreach ($error as $key => $value) {
                    $attributes[$key] = $value;
                }
            }
            $ex = new EntityException(EntityException::VALIDATION_FAILED, [get_class($this), $validation->count()]);
            $ex->setInvalidAttributes($attributes);
            throw $ex;
        }

        return $this;
    }
776609
public function populate($data = array())
    {
        parent::populate($data);

        if (isset($data['scheduleOccurrenceAuto']) && $data['scheduleOccurrenceAuto'] !== null) {
            $this->scheduleOccurrenceAuto = $data['scheduleOccurrenceAuto'];
        }

        if (isset($data['occurrenceNumber']) && $data['occurrenceNumber'] !== null) {
            $this->occurrenceNumber = $data['occurrenceNumber'];
        }

        if (isset($data['winningOccurrenceNumber']) && $data['winningOccurrenceNumber'] !== null) {
            $this->occurrenceNumber = $data['winningOccurrenceNumber'];
        }

        if (isset($data['occurrenceType']) && $data['occurrenceType'] !== null) {
            $this->occurrenceType = $data['occurrenceType'];
        }
    }
397875
public function populate($data = array())
    {
        $this->pageId = (isset($data['pageId'])) ? $data['pageId'] : null;
        $this->pageName = (isset($data['pageName'])) ? $data['pageName'] : null;
        $this->pageLink = (isset($data['pageLink'])) ? $data['pageLink'] : null;

    }
935137
public function data(array $data)
    {
        $this->columns(array_keys($data))->values(array_values($data));

        return $this;
    }
98412
public function setMany(array $data)
    {
        foreach($data as $key => $value) {
            $this->_data[$key] = $value;
        }

        return $this;
    }
1367440
protected function buildModel(array $data = array()){
        $Model = NULL;
        if (isset($this->model)){
            $Model = new $this->model();
            $Model->setBaseUrl($this->getBaseUrl());
            if ($this->getAuth() !== NULL) {
                $Model->setAuth($this->getAuth());
            }
            if (!empty($data)){
                foreach($data as $key => $value){
                    $Model->set($key,$value);
                }
            }
        }
        return $Model;
    }