Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Aggregate over Arrays / via ArrayDataSource #1167

Open
alex-kalanis opened this issue Mar 7, 2025 · 0 comments
Open

Feature: Aggregate over Arrays / via ArrayDataSource #1167

alex-kalanis opened this issue Mar 7, 2025 · 0 comments

Comments

@alex-kalanis
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant