mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\ActivityBundle\Export\Aggregator;
|
|
|
|
use Chill\MainBundle\Export\AggregatorInterface;
|
|
use Chill\ActivityBundle\Export\Declarations;
|
|
use Doctrine\ORM\QueryBuilder;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
class SentReceivedAggregator implements AggregatorInterface
|
|
{
|
|
public function addRole(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function alterQuery(QueryBuilder $qb, $data)
|
|
{
|
|
$qb->addSelect('AS activity_sent_received_aggregator')
|
|
->addGroupBy('activity_sent_received_aggregator');
|
|
}
|
|
|
|
public function applyOn(): string
|
|
{
|
|
return Declarations::ACTIVITY;
|
|
}
|
|
|
|
public function buildForm(FormBuilderInterface $builder)
|
|
{
|
|
// No form needed
|
|
}
|
|
|
|
public function getLabels($key, array $values, $data)
|
|
{
|
|
return function ($value): string {
|
|
if ('_header' === $value) {
|
|
return '';
|
|
}
|
|
};
|
|
}
|
|
|
|
public function getQueryKeys($data): array
|
|
{
|
|
return ['activity_sent_received_aggregator'];
|
|
}
|
|
|
|
public function getTitle(): string
|
|
{
|
|
return 'Group activity by sentreceived';
|
|
}
|
|
}
|