Retrieves an associated model in conjunction with the current one

@param   \Hubzero\Database\Rows  $rows  The rows to parse and augment
@return  \Hubzero\Database\Rows
@since   2.0.0
358423
private function parseIncluding($rows)
	{
		$subs       = null;
		$constraint = null;
		foreach ($this->includes as $relationship)
		{
			// Check for array, meaning we have relationship_name => constraint
			if (is_array($relationship))
			{
				list($relationship, $constraint) = $relationship;
			}

			// Parse for nested relationships
			if (strpos($relationship, '.'))
			{
				list($relationship, $subs) = explode('.', $relationship, 2);
			}

			// If we have subs and a constraint, the constraint should apply to the subs, not the intermediate relation
			if (isset($subs) && isset($constraint))
			{
				$subs       = [$subs, $constraint];
				$constraint = null;
			}

			// Get the actual rows
			$rows = $this->$relationship()->seedWithRelation($rows, $relationship, $constraint, $subs);

			// Reset some vars
			$subs       = null;
			$constraint = null;
		}

		return $rows;
	}
127521
public function extractNotificationsFromRows(array $rows): array
    {
        $notifications = [];
        foreach ($rows as $row) {
            $notifications[] = $this->extractNotificationFromRow($row);
        }

        return $notifications;
    }
1054529
public function createRows(array $rows): array
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        $list = [];
        foreach ($rows as $key => $row) {
            $key = $this->getNewKey();
            $this->data[$key] = $list[$key] = $row;
        }

        if ($list) {
            $this->save();
        }

        return $list;
    }
1026906
public function castRow($row)
    {
        if ($this->isLocked) {
            // schema is locked, no more inferring is needed
            return parent::castRow($row);
        } else {
            // add the row to the inferrer, update the descriptor according to the best inferred fields
            $this->fieldsInferer->addRows([$row]);
            $this->descriptor->fields = [];
            foreach ($this->fieldsInferer->infer() as $fieldName => $inferredField) {
                /* @var Fields\BaseField $inferredField */
                $this->descriptor->fields[] = $inferredField->descriptor();
            }
            $this->castRows = $this->fieldsInferer->castRows();

            return $this->castRows[count($this->castRows) - 1];
        }
    }
58486
public function extractBookmarksFromRows(array $rows): array
    {
        $bookmarks = [];
        foreach ($rows as $row) {
            $bookmarks[] = $this->extractBookmarkFromRow($row);
        }

        return $bookmarks;
    }
1050321
public function getModel(array $row = []): ModelInterface
    {
        $model = $this->resolve(Model::class, $row);

        if (!is_null($this->database)) {
            $model->setDatabase($this->database);
        }

        if (!is_null($this->table)) {
            $model->setTable($this->table);
        }

        return $model;
    }
1273011
public function rowsFromRaw($data)
	{
		$rows = new Rows;

		if ($data && count($data) > 0)
		{
			foreach ($data as $row)
			{
				$rows->push(self::newFromResults($row));
			}
		}

		return $rows;
	}
816990
public function upsert($rows, $updates = [])
    {
        return $this->db->upsert($this->table, $rows, $updates);
    }
997677
protected function join($row)
    {
        $keys['local']   = $this->keys['local'];
        $keys['foreign'] = $this->keys['foreign'];

        if ($this->relationType == 'hasAndBelongsToMany')
        {
            $join = Database::table($this->getJunction())
                    ->groupBy($this->tables['local'] . '_id')
                    ->where($this->tables['local'] . '_id', '=', $row->{$keys['local']})
                    ->findAll()
                    ->asArray(null, $this->tables['foreign'] . '_id');


            if (empty($join))
                return [];

            return Database::table($this->tables['foreign'])
                            ->where($keys['foreign'], 'IN', $join[$row->{$keys['local']}]);
        }

        return Database::table($this->tables['foreign'])
                        ->where($keys['foreign'], '=', $row->{$keys['local']});
    }
1131771
public function replaceRows(array $rows): array
    {
        if (null === $this->data) {
            $this->buildIndex();
        }

        $list = [];
        foreach ($rows as $key => $row) {
            if (strpos($key, '@@')) {
                $key = $this->getNewKey();
            }
            $this->data[$key] = $list[$key] = $row;
        }

        if ($list) {
            $this->save();
        }

        return $list;
    }
672041
public static function getRowInstance($row) {
		if (is_array($row)) {
			return new \Aginev\Datagrid\Rows\ArrayRow($row);
		} else if ($row instanceof Model) {
			return new \Aginev\Datagrid\Rows\ModelRow($row);
		} else if ($row instanceof Collection) {
			return new \Aginev\Datagrid\Rows\CollectionRow($row);
		} else if (is_object($row)) {
			return new \Aginev\Datagrid\Rows\ObjectRow($row);
		}

		throw new CellException('Unsupported data!');
	}
1156319
public function batchInsert($rows)
    {
        $insertedIds = $this->db->batchInsert($this->name, $rows);

        foreach ($rows as $key => $row) {
            $rows[$key]['_id'] = $insertedIds[$key];
        }

        return $rows;
    }
198541
public static function fromRowArray(Table $table, array $rows) : RowSet
    {
        $self = new self($table);

        foreach ($rows as $row) {
            $self->rows[] = $self->createRow($row);
        }

        return $self;
    }
844292
public function setRows($rows) {
		if ($rows && count($rows) > 0) {
			foreach ($rows as $row) {
				$this->setRow($row);
			}
		}

		return $this;
	}
316613
public function populate($rows): array
    {
        $result = [];

        if ($this->indexBy === null) {
            return array_values($rows); // reset storage internal keys
        }

        foreach ($rows as $row) {
            if (is_string($this->indexBy)) {
                $key = $row[$this->indexBy];
            } else {
                $key = call_user_func($this->indexBy, $row);
            }
            $result[$key] = $row;
        }

        return $result;
    }
38667
public static function addRowsToMap($rows)
    {
        $firstRow = reset($rows);
        $idAttribute = static::getIdAttribute();
        if ($firstRow instanceof ActiveRecord) {
            foreach ($rows as $row) {
                self::$identityMap[$row[$idAttribute]] = $row->toArray();
                foreach (static::getUniqueAttributes() as $uniqueAttribute) {
                    self::$uniqueAttributeToId[$uniqueAttribute][$row[$uniqueAttribute]] = $row[$idAttribute];
                }
            }
        } else {
            foreach ($rows as $row) {
                self::$identityMap[$row[$idAttribute]] = $row;
                foreach (static::getUniqueAttributes() as $uniqueAttribute) {
                    self::$uniqueAttributeToId[$uniqueAttribute][$row[$uniqueAttribute]] = $row[$idAttribute];
                }
            }
        }
        $maxSize = self::getIdentityMapMaxSize();
        if ($maxSize !== -1) {
            $count = count(self::$identityMap);
            if ($count > $maxSize) {
                self::$identityMap = array_slice(
                    self::$identityMap,
                    $count - $maxSize,
                    $maxSize
                );
            }
        }
    }
1260327
public function getCurrentOption(Row $row)
	{
		foreach ($this->getOptions() as $option) {
			if ($option->getValue() == $row->getValue($this->getColumn())) {
				return $option;
			}
		}

		return null;
	}