@param $rows

@return mixed
551446
protected function createObjects($rows)
    {
        $models = [];

        foreach ($rows as $key => $row) {
            $models[$key] = $this->createObject($row);
        }

        return $models;
    }
512352
public function process(array $rows)
    {
        foreach ($this->queue as $queue) {
            // Just references
            $relation = $queue[self::PARAM_RELATION];
            $args = $queue[self::PARAM_ARGS];

            switch ($relation) {
                case 'asOneToMany':
                    $relation = new OneToMany($this->db);

                    // Grab values from arguments passed in $db->asOneToMany()
                    $slaveTable = $args[0];
                    $slaveColumnId = $args[1];
                    $alias = $args[2];

                    $rows = $relation->merge($this->getMasterPkName(), $rows, $alias, $slaveTable, $slaveColumnId);
                break;

                case 'asOneToOne':
                    // Grab values from arguments passed in $db->asOneToOne()
                    $column = $args[0];
                    $alias = $args[1];
                    $table = $args[2];
                    $link = $args[3];

                    $relation = new OneToOne($this->db);
                    $rows = $relation->merge($rows, $column, $alias, $table, $link);
                break;

                case 'asManyToMany':
                    // Grab values from arguments passed in $db->asManyToMany()
                    $alias = $args[0];
                    $junction = $args[1];
                    $column = $args[2];
                    $table = $args[3];
                    $pk = $args[4];
                    $columns = $args[5];

                    $relation = new ManyToMany($this->db);
                    $rows = $relation->merge($this->getMasterPkName(), $alias, $rows, $junction, $column, $table, $pk, $columns);
                break;
            }
        }

        $this->clearQueue();
        return $rows;
    }
99375
final public function rowSet(array $rows) : \Dms\Core\Persistence\Db\RowSet
    {
        return new RowSet($this->primaryTable, $rows);
    }
913120
private function sanitize(array $rows)
    {
        $_documentClass = $this->_documentClass;

        if (isset($this->_options[self::ENTRY_SANITIZE]) && $this->_options[self::ENTRY_SANITIZE]) {
            foreach ($rows as $key => $value) {

                if (is_array($value) && isset($value[$_documentClass::ENTRY_ID])) {
                    unset($rows[$key][$_documentClass::ENTRY_ID]);
                }

                if (is_array($value) && isset($value[$_documentClass::ENTRY_REV])) {
                    unset($rows[$key][$_documentClass::ENTRY_REV]);
                }
            }
        }

        return $rows;
    }
481610
protected function getDbEntitiesFromRowsPaginated(array $rows, $pagination)
    {
        if ($pagination) {
            $totalRowCount = $this->db->fetchValue('SELECT FOUND_ROWS()');
            return [$this->getDbEntitiesFromRows($rows), $totalRowCount];
        }

        return $this->getDbEntitiesFromRows($rows);
    }
211503
private function validateRows($rows)
    {
        if ($rows === false)
            return $rows;
        if (empty($rows))
            return $rows ?: [];
        foreach($rows as $e=>$r){

            $rows[$e] = $this->validateRow($r);
        }
        return $rows;

    }
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;
	}
315639
private function getTableTags($tables, $rows)
    {
        $tags = [];
        $type = $this->reflector->getType();

        foreach ($tables as $table) {
            $isSpecific = (isset($rows[$table]) && !empty($rows[$table]));

            // These types of queries require a specific tag
            if (($type === Reflector::QUERY_TYPE_SELECT && $isSpecific) ||
                ($type === Reflector::QUERY_TYPE_UPDATE && !$isSpecific) ||
                ($type === Reflector::QUERY_TYPE_DELETE && !$isSpecific) ||
                ($type === Reflector::QUERY_TYPE_TRUNCATE)) {

                $tags[] = $this->prefix($table, self::PREFIX_TABLE_SPECIFIC);
            }

            // While these ones require an unspecific one
            if (($type === Reflector::QUERY_TYPE_SELECT && !$isSpecific) ||
                ($type === Reflector::QUERY_TYPE_UPDATE) ||
                ($type === Reflector::QUERY_TYPE_DELETE) ||
                ($type === Reflector::QUERY_TYPE_INSERT)) {

                $tags[] = $this->prefix($table, self::PREFIX_TABLE_UNSPECIFIC);
            }
        }

        return $tags;
    }
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!');
	}
158647
public function extractGroupsFromRows(array $rows)
    {
        $groups = array();

        foreach ($rows as $row) {
            $group = new Group();
            $group->id = (int)$row['id'];
            $group->created = (int)$row['created'];
            $group->creatorId = (int)$row['creator_id'];
            $group->modified = (int)$row['modified'];
            $group->modifierId = (int)$row['modifier_id'];
            $group->identifier = $row['name'];

            $groups[] = $group;
        }

        return $groups;
    }
580799
public function normalizeColumns(array &$rows) : array
    {
        $maxNumColumns = 0;

        // Find the max number of columns that appear in any given row
        foreach ($rows as $row) {
            $maxNumColumns = max($maxNumColumns, count($row));
        }

        $maxLengths = array_pad([], $maxNumColumns, 0);

        // Normalize the number of columns in each row
        foreach ($rows as &$row) {
            $row = array_pad($row, $maxNumColumns, '');
        }

        // Get the length of the longest value in each column
        foreach ($rows as &$row) {
            foreach ($row as $column => &$value) {
                $value = trim($value);
                $maxLengths[$column] = max($maxLengths[$column], mb_strlen($value));
            }
        }

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

        return $bookmarks;
    }
868153
public function toFeatureCollection($rows)
    {
        /** @var Feature $feature */
        foreach ($rows as $k => $feature) {
            $rows[ $k ] = $feature->toGeoJson(true);
        }
        return array("type"     => "FeatureCollection",
                     "features" => $rows);
    }
409822
public function generate(array $rows): array
    {
        $generatedRows = [];
        foreach ($rows as $identifier => $row) {
            $generatedRows = $this->generateRowsIfNeeded($identifier, $row, $generatedRows);
        }
        return $generatedRows;
    }
986574
protected function parseRow($row)
    {
        list($k, $v) = explode(':', $row, 2);

        if (preg_match('/^db\d+$/', $k)) {
            $v = $this->parseDatabaseStats($v);
        }

        return array($k, $v);
    }
767004
protected function getHtmlBody(array $rows): string
  {
    $ret = '';
    $i   = 0;
    foreach ($rows as $row)
    {
      $class = static::$class;
      if ($class!==null) $class .= ' ';
      $class .= ($i % 2==0) ? 'even' : 'odd';

      $ret .= Html::generateTag('tr', ['class' => $class]);
      foreach ($this->columns as $column)
      {
        $ret .= $column->getHtmlCell($row);
      }
      $ret .= '</tr>';
      $i++;
    }

    return $ret;
  }
552597
public function setRows($rows)
    {
        intval($rows);
        if ($rows < 1) {
            $rows = 1;
        }

        $this->rows = $rows;

        return $this;
    }