Skip to content

Feature: Aggregate over Arrays / via ArrayDataSource #1167

@alex-kalanis

Description

@alex-kalanis

Greetings,

is it possible to accept ArrayDataSource|array as another type in \Contributte\Datagrid\AggregationFunction\IAggregationFunction::processDataSource() ?

Then to \Contributte\Datagrid\DataSource\ArrayDataSource something like following:

	public function processAggregation(IAggregationFunction $function): void
	{
		$function->processDataSource($this);
	}

And then into \Contributte\Datagrid\AggregationFunction\FunctionSum::processDataSource following part:

		if ( $dataSource instanceof ArrayDataSource) {
			foreach( $dataSource->getData() as $item )
				$this->result += $item[$this->column];
		}

		if ( is_array($dataSource)) {
			foreach( $dataSource as $item )
				$this->result += $item[$this->column];
		}

Use case:

Due sheer completness of dataset we cannot access the data from it directly via SQL, so we pre-calculate it in parts and then use it with aggregation. That makes us dependent on arrays / ArrayDataSource. And due limitation of other parts of Datagrid we must store its affected files locally and overwrite them on deploy.

Do you want PR? Discuss.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Waiting

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions