-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLimitable.php
More file actions
78 lines (69 loc) · 1.89 KB
/
Copy pathLimitable.php
File metadata and controls
78 lines (69 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
namespace Bdf\Prime\Query\Contract;
/**
* Interface for query with limits, offset and pagination
*/
interface Limitable
{
/**
* Limit executed query to specified amount of records
* Implemented at adapter-level for databases that support it
*
* @param int|null $limit Number of records to return
* @param int|null $offset Record to start at for limited result set
*
* @return $this This Query instance.
*/
public function limit(?int $limit, ?int $offset = null);
/**
* Sets the limit and count by page number.
*
* @todo l'api devrait etre "limitPage($rowCount, $page = 1)"
*
* @param int $page Limit results to this page number.
* @param int $rowCount Use this many rows per page.
*
* @return $this This Query instance.
*/
public function limitPage(int $page, int $rowCount = 1);
/**
* Get the page of pagination
*
* @return int
*/
public function getPage(): int;
/**
* Get limit value
*
* @return int|null The limit, or null if not defined
*/
public function getLimit(): ?int;
/**
* Offset executed query to skip specified amount of records
* Implemented at adapter-level for databases that support it
*
* @param int|null $offset Record to start at for limited result set
*
* @return $this This Query instance.
*/
public function offset(?int $offset);
/**
* Get offset value
*
* @return int|null The offset, or null is not defined
*/
public function getOffset(): ?int;
/**
* Check if query has limit attribute
*
* @return bool
*/
public function isLimitQuery(): bool;
/**
* Check if query has pagination
* Is true whether the query has first result AND max result set
*
* @return bool
*/
public function hasPagination(): bool;
}