/** * @param FilterCollection $filters */ protected function addPageSizeFilter(FilterCollection $filters) { $pageSizeFilterKey = $this->getPageSizeFilterKey(); if (!$filters->has($pageSizeFilterKey)) { $filters->add($pageSizeFilterKey, new PageSizeFilter(DataType::INTEGER, 'The number of items per page.', $this->getDefaultPageSize())); } }
/** * @param FilterCollection $filters * @param string $entityClass */ protected function addSortFilter(FilterCollection $filters, $entityClass) { $sortFilterKey = $this->getSortFilterKey(); if (!$filters->has($sortFilterKey)) { $filters->add($sortFilterKey, new SortFilter(DataType::ORDER_BY, $this->getSortFilterDescription(), function () use($entityClass) { return $this->getDefaultValue($entityClass); }, function ($value) { return $this->convertDefaultValueToString($value); })); } }