Skip to content

Commit

Permalink
fix: data collector not collecting pagination and filtration data pro…
Browse files Browse the repository at this point in the history
…perly
  • Loading branch information
Kreyu authored Oct 17, 2024
1 parent f6e060f commit 22b5206
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DataCollector/DataTableDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function collectFiltrationData(DataTableInterface $dataTable, FiltrationD
$this->data[$filter->getDataTable()->getName()]['filters'][$filter->getName()] ??= [];
$this->data[$filter->getDataTable()->getName()]['filters'][$filter->getName()] += [
'data' => $filterData,
'operator_label' => $filterData->getOperator()->getLabel(),
'operator_label' => $filterData->getOperator()?->getLabel(),
];
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/DataCollector/EventListener/DataCollectorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Kreyu\Bundle\DataTableBundle\Event\DataTableEvent;
use Kreyu\Bundle\DataTableBundle\Event\DataTableEvents;
use Kreyu\Bundle\DataTableBundle\Event\DataTableFiltrationEvent;
use Kreyu\Bundle\DataTableBundle\Event\DataTablePaginationEvent;
use Kreyu\Bundle\DataTableBundle\Event\DataTableSortingEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

Expand All @@ -23,6 +24,7 @@ public static function getSubscribedEvents(): array
return [
DataTableEvents::POST_INITIALIZE => ['collectDataTable', 255],
DataTableEvents::POST_FILTER => ['collectFiltrationData', 255],
DataTableEvents::POST_PAGINATE => ['collectPaginationData', 255],
DataTableEvents::POST_SORT => ['collectSortingData', 255],
];
}
Expand All @@ -32,6 +34,11 @@ public function collectDataTable(DataTableEvent $event): void
$this->dataCollector->collectDataTable($event->getDataTable());
}

public function collectPaginationData(DataTablePaginationEvent $event): void
{
$this->dataCollector->collectPaginationData($event->getDataTable(), $event->getPaginationData());
}

public function collectFiltrationData(DataTableFiltrationEvent $event): void
{
$this->dataCollector->collectFiltrationData($event->getDataTable(), $event->getFiltrationData());
Expand Down

0 comments on commit 22b5206

Please sign in to comment.