1 | <?php |
||
23 | trait EntityQueryTrait |
||
24 | { |
||
25 | use QueryTrait; |
||
26 | |||
27 | public $noInitModel; |
||
28 | |||
29 | /** |
||
30 | * Build model without any initializations. |
||
31 | */ |
||
32 | 359 | public function buildNoInitModel() |
|
39 | |||
40 | /** |
||
41 | * Specify guid attribute. |
||
42 | * @param string|array $guid |
||
43 | * @param false|string $like false, 'like', 'or like', 'not like', 'or not like'. |
||
44 | * @return $this |
||
45 | */ |
||
46 | 16 | public function guid($guid, $like = false) |
|
51 | |||
52 | /** |
||
53 | * Specify id attribute. |
||
54 | * @param string|integer|array $id |
||
55 | * @param false|string $like false, 'like', 'or like', 'not like', 'or not like'. |
||
56 | * @return $this |
||
57 | */ |
||
58 | 9 | public function id($id, $like = false) |
|
63 | |||
64 | /** |
||
65 | * Specify GUID or ID attribute. |
||
66 | * Scalar parameter is acceptable only. |
||
67 | * Please do not pass an array to the first parameter. |
||
68 | * @param string|integer $param |
||
69 | * @param bool|string $like false, 'like', 'or like', 'not like', 'or not like'. |
||
70 | * @return $this |
||
71 | */ |
||
72 | public function guidOrId($param, $like = false) |
||
80 | |||
81 | /** |
||
82 | * Specify create time range. |
||
83 | * @param string $start |
||
84 | * @param string $end |
||
85 | * @return $this |
||
86 | */ |
||
87 | 6 | public function createdAt($start = null, $end = null) |
|
96 | |||
97 | /** |
||
98 | * Specify order by creation time. |
||
99 | * @param string $sort only 'SORT_ASC' and 'SORT_DESC' are acceptable. |
||
100 | * @return $this |
||
101 | */ |
||
102 | 3 | public function orderByCreatedAt($sort = SORT_ASC) |
|
111 | |||
112 | /** |
||
113 | * Specify update time range. |
||
114 | * @param string $start |
||
115 | * @param string $end |
||
116 | * @return $this |
||
117 | */ |
||
118 | 7 | public function updatedAt($start = null, $end = null) |
|
127 | |||
128 | /** |
||
129 | * Specify order by update time. |
||
130 | * @param string $sort only 'SORT_ASC' and 'SORT_DESC' are acceptable. |
||
131 | * @return $this |
||
132 | */ |
||
133 | 2 | public function orderByUpdatedAt($sort = SORT_ASC) |
|
142 | |||
143 | public static $pageAll = 'all'; |
||
144 | public static $defaultPageSize = 10; |
||
145 | |||
146 | /** |
||
147 | * Specify page condition. |
||
148 | * @param string|int $pageSize It will return all models if it is 'all', |
||
149 | * or it will be regarded as sum of models. |
||
150 | * @param int $currentPage The current page number if it is integer begun with 0. |
||
151 | * @return $this |
||
152 | */ |
||
153 | 3 | public function page($pageSize = 10, $currentPage = 0) |
|
169 | } |
||
170 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: