Creates a new dataobject

@param stdClass $row the data row to use.

@return mixed the instantiated data object or the original object if
no <i>$row_wrapper_class</i> is defined for this
recordset wrapper.
183621
protected function instantiateRowWrapperObject($row)
    {
        if ($this->row_wrapper_class === null) {
            $object = $row;
        } else {
            $object = new $this->row_wrapper_class(
                $row,
                $this->getOption('read_only')
            );
        }

        return $object;
    }
169428
public static function load_from_record($row) {
        return new question_hint_ddmarker($row->id, $row->hint, $row->hintformat,
                $row->shownumcorrect, $row->clearwrong, $row->options);
    }
483431
protected function populateItem($row)
    {
        $class = $row['type'] == Item::TYPE_PERMISSION ? Permission::className() : Role::className();

        if (!isset($row['data']) || ($data = @unserialize($row['data'])) === false) {
            $data = null;
        }

        return new $class([
            'name' => $row['name'],
            'type' => $row['type'],
            'description' => $row['description'],
            'ruleName' => $row['rule_name'],
            'data' => $data,
            'createdAt' => $row['created_at'],
            'updatedAt' => $row['updated_at'],
            'parents' => isset($row['parents']) ? $row['parents'] : null,
        ]);
    }
1150697
public function useRenderer($row = null)
	{
		$renderer = $this->getRenderer();

		if ($row instanceof Row) {
			$args = [$row->getItem()];
		} else {
			$args = [];
		}

		if (!$renderer) {
			throw new DataGridColumnRendererException;
		}

		if ($renderer->getConditionCallback()) {
			if (!call_user_func_array($renderer->getConditionCallback(), $args)) {
				throw new DataGridColumnRendererException;
			}

			return call_user_func_array($renderer->getCallback(), $args);
		}

		return call_user_func_array($renderer->getCallback(), $args);
	}
1146086
public function addRow(array $row)
    {
        if (is_array($this->fields)) {
            $assoc = $row;
            $row = [];
            foreach ($this->fields as $field) {
                $row[] = isset($assoc[$field]) ? $assoc[$field] : "";
            }
        }

        $this->data[] = $row;

        return $this;
    }
64684
public static function load_from_record($row) {
        return new question_hint_with_parts($row->id, $row->hint, $row->hintformat,
                $row->shownumcorrect, $row->clearwrong);
    }
667557
public static function populateRecord($record, $row)
    {
        $attributes = [];
        if (isset($row['_source'])) {
            $attributes = $row['_source'];
        }
        if (isset($row['fields'])) {
            // reset fields in case it is scalar value
            $arrayAttributes = $record->arrayAttributes();
            foreach($row['fields'] as $key => $value) {
                if (!isset($arrayAttributes[$key]) && count($value) === 1) {
                    $row['fields'][$key] = reset($value);
                }
            }
            $attributes = array_merge($attributes, $row['fields']);
        }

        parent::populateRecord($record, $attributes);

        $pk = static::primaryKey()[0];//TODO should always set ID in case of fields are not returned
        if ($pk === '_id') {
            $record->_id = $row['_id'];
        }
        $record->_highlight = isset($row['highlight']) ? $row['highlight'] : null;
        $record->_score = isset($row['_score']) ? $row['_score'] : null;
        $record->_version = isset($row['_version']) ? $row['_version'] : null; // TODO version should always be available...
        $record->_explanation = isset($row['_explanation']) ? $row['_explanation'] : null;
    }
255230
protected function loadObjects(array $row)
    {

        $objectsInfo = [];
        foreach ($row as $alias => $value) {
            $pos = strrpos($alias, ISelector::ALIAS_SEPARATOR);
            if (!$pos) {
                throw new LoadEntityException($this->translate(
                    'Cannot load objects from data row. Field alias "{alias}" is not correct.',
                    ['alias' => $alias]
                ));
            }
            $collectionPath = substr($alias, 0, $pos);
            $fieldName = substr($alias, $pos + 1);

            if (!isset($objectsInfo[$collectionPath])) {
                $objectsInfo[$collectionPath] = [];
            }
            $objectsInfo[$collectionPath][$fieldName] = $value;
        }

        $mainObject = null;
        foreach ($objectsInfo as $collectionPath => $objectInfo) {

            if (!array_key_exists(IObject::FIELD_TYPE, $objectInfo)) {
                throw new LoadEntityException($this->translate(
                    'Cannot load object from data row. Information about object type is not found.'
                ));
            }

            if (!is_null($objectInfo[IObject::FIELD_TYPE])) {
                $object = $this->loadObject($objectInfo[IObject::FIELD_TYPE], $objectInfo);
                if (!$mainObject && !substr_count($collectionPath, ISelector::FIELD_SEPARATOR)) {
                    $mainObject = $object;
                }
            }

        }
        if (!$mainObject) {
            throw new LoadEntityException($this->translate(
                'Cannot detect main object from data row.'
            ));
        }

        return $mainObject;
    }
495966
public function create($data)
    {
        $response = $this->api->post($this->url(), $data);
        $className = $this->objectClass;

        return new $className($this->api, $this, $response->data);
    }
933848
public function addRow($row)
    {
        if ($row instanceof TableSeparator) {
            $this->rowsCopy[] = $row;

            return parent::addRow($row);
        }

        if (!is_array($row)) {
            throw new \InvalidArgumentException('A row must be an array or a TableSeparator instance.');
        }

        $this->rowsCopy[] = array_values($row);

        return parent::addRow($row);
    }
490848
protected function hydrate(array $row)
    {
        $fieldNames = $this->definition->getFieldNames(true);
        $entity     = new Entity($this->definition);
        foreach ($fieldNames as $fieldName) {
            $entity->set($fieldName, $row[$fieldName]);
        }
        return $entity;
    }
431375
public function created_at($row)
    {
        if (is_object($row))
        {
            $row->created_at = date('Y-m-d H:i:s');
        }
        else
        {
            $row['created_at'] = date('Y-m-d H:i:s');
        }

        return $row;
    }
577285
function factory($id,$row) {
		$mapper=clone($this);
		$mapper->reset();
		$mapper->id=$id;
		foreach ($row as $field=>$val)
			$mapper->document[$field]=$val;
		$mapper->query=[clone($mapper)];
		if (isset($mapper->trigger['load']))
			\Base::instance()->call($mapper->trigger['load'],$mapper);
		return $mapper;
	}
377418
public function render(Row $row)
	{
		if (!$this->shouldBeRendered($row)) {
			return null;
		}

		try {
			// Renderer function may be used
			return $this->useRenderer($row);
		} catch (DataGridColumnRendererException $e) {
			// Do not use renderer
		}

		$link = $this->createLink(
			$this->grid,
			$this->href,
			$this->getItemParams($row, $this->params) + $this->parameters
		);

		$a = Html::el('a')->href($link);

		$this->tryAddIcon($a, $this->getIcon($row), $this->getName());

		if (!empty($this->data_attributes)) {
			foreach ($this->data_attributes as $key => $value) {
				$a->data($key, $value);
			}
		}

		if (!empty($this->attributes)) {
			$a->addAttributes($this->attributes);
		}

		$a->addText($this->translate($this->getName()));

		if ($this->title) {
			$a->title($this->translate($this->getTitle($row)));
		}

		if ($this->class) {
			$a->class($this->getClass($row));
		}

		if ($confirm = $this->getConfirm($row)) {
			$a->data(static::$data_confirm_attribute_name, $confirm);
		}

		if ($this->open_in_new_tab) {
			$a->addAttributes(['target' => '_blank']);
		}

		return $a;
	}
58441
public function col_timemarked(stdClass $row) {
        $o = '-';

        if ($row->timemarked && $row->grade !== null && $row->grade >= 0) {
            $o = userdate($row->timemarked);
        }
        if ($row->timemarked && $this->is_downloading()) {
            // Force it for downloads as it affects import.
            $o = userdate($row->timemarked);
        }

        return $o;
    }
298367
final protected function constructNewObjectsFromRow(LoadingContext $context, Row $row) : ITypedObject
    {
        return $this->mapping->constructNewObjectFromRow($row);
    }
1050898
public function getDataCellContent($row)
	{
		$data=$this->grid->dataProvider->data[$row];
		if($this->urlExpression!==null)
			$url=$this->evaluateExpression($this->urlExpression,array('data'=>$data,'row'=>$row));
		else
			$url=$this->url;
		if($this->labelExpression!==null)
			$label=$this->evaluateExpression($this->labelExpression,array('data'=>$data,'row'=>$row));
		else
			$label=$this->label;
		$options=$this->linkHtmlOptions;
		if(is_string($this->imageUrl))
			return CHtml::link(CHtml::image($this->imageUrl,$label),$url,$options);
		else
			return CHtml::link($label,$url,$options);
	}