Beispiel #1
0
 /**
  * Pageable constructor.
  *
  * @param                      $pageNumber
  * @param                      $pageSize
  * @param SortInterface|null   $sort
  * @param FilterInterface|null $filter
  * @param FieldsInterface|null $fields
  * @param FieldsInterface|null $distinctFields
  */
 public function __construct($pageNumber, $pageSize, SortInterface $sort = null, FilterInterface $filter = null, FieldsInterface $fields = null, FieldsInterface $distinctFields = null)
 {
     $this->pageNumber = (int) $pageNumber;
     $this->pageSize = (int) $pageSize;
     $this->sort = $sort ? $sort : Sort::null();
     $this->filter = $filter ? $filter : Filter::null();
     $this->fields = $fields ? $fields : Fields::null();
     $this->distinctFields = $distinctFields ? $distinctFields : Fields::null();
 }
Beispiel #2
0
 /**
  * Page constructor.
  *
  * @param array           $elements
  * @param                 $totalElements
  * @param                 $pageNumber
  * @param                 $totalPages
  * @param SortInterface   $sort
  * @param FilterInterface $filter
  * @param FieldsInterface $fields
  */
 public function __construct(array $elements, $totalElements, $pageNumber, $totalPages, SortInterface $sort = null, FilterInterface $filter = null, FieldsInterface $fields = null)
 {
     $this->elements = ImmutableTypedCollection::fromArray(array_values($elements));
     $this->totalElements = (int) $totalElements;
     $this->pageNumber = (int) $pageNumber;
     $this->totalPages = (int) $totalPages;
     $this->sort = $sort ? $sort : Sort::null();
     $this->filter = $filter ? $filter : Filter::null();
     $this->fields = $fields ? $fields : Fields::null();
 }