1 | <?php |
||
25 | trait EntityQueryTrait |
||
26 | { |
||
27 | use QueryTrait; |
||
28 | |||
29 | /** |
||
30 | * @var BaseEntityModel |
||
31 | */ |
||
32 | public $noInitModel; |
||
33 | |||
34 | /** |
||
35 | * Build model without any initializations. |
||
36 | */ |
||
37 | 366 | public function buildNoInitModel() |
|
44 | |||
45 | /** |
||
46 | * Specify guid attribute. |
||
47 | * @param string|array $guid |
||
48 | * @param false|string $like false, 'like', 'or like', 'not like', 'or not like'. |
||
49 | * @return $this |
||
50 | */ |
||
51 | 17 | public function guid($guid, $like = false) |
|
57 | |||
58 | /** |
||
59 | * Specify id attribute. |
||
60 | * @param string|integer|array $id |
||
61 | * @param false|string $like false, 'like', 'or like', 'not like', 'or not like'. |
||
62 | * @return $this |
||
63 | */ |
||
64 | 10 | public function id($id, $like = false) |
|
70 | |||
71 | /** |
||
72 | * Specify GUID or ID attribute. |
||
73 | * Scalar parameter is acceptable only. |
||
74 | * Please do not pass an array to the first parameter. |
||
75 | * @param string|integer $param |
||
76 | * @param bool|string $like false, 'like', 'or like', 'not like', 'or not like'. |
||
77 | * @return $this |
||
78 | */ |
||
79 | 1 | public function guidOrId($param, $like = false) |
|
86 | |||
87 | /** |
||
88 | * Specify creation time range. |
||
89 | * @param string $start |
||
90 | * @param string $end |
||
91 | * @return $this |
||
92 | */ |
||
93 | 7 | public function createdAt($start = null, $end = null) |
|
102 | |||
103 | /** |
||
104 | * Specify creation time as today (in locally). |
||
105 | * @return $this |
||
106 | */ |
||
107 | 1 | public function createdAtToday() |
|
119 | |||
120 | /** |
||
121 | * Specify order by creation time. |
||
122 | * @param string $sort only 'SORT_ASC' and 'SORT_DESC' are acceptable. |
||
123 | * @return $this |
||
124 | */ |
||
125 | 3 | public function orderByCreatedAt($sort = SORT_ASC) |
|
134 | |||
135 | /** |
||
136 | * Specify last updated time range. |
||
137 | * @param string $start |
||
138 | * @param string $end |
||
139 | * @return $this |
||
140 | */ |
||
141 | 8 | public function updatedAt($start = null, $end = null) |
|
150 | |||
151 | /** |
||
152 | * Specify last updated time as today (in locally). |
||
153 | * @return $this |
||
154 | */ |
||
155 | 1 | public function updatedAtToday() |
|
167 | |||
168 | /** |
||
169 | * Specify order by update time. |
||
170 | * @param string $sort only 'SORT_ASC' and 'SORT_DESC' are acceptable. |
||
171 | * @return $this |
||
172 | */ |
||
173 | 2 | public function orderByUpdatedAt($sort = SORT_ASC) |
|
182 | |||
183 | public static $pageAll = 'all'; |
||
184 | public static $defaultPageSize = 10; |
||
185 | |||
186 | /** |
||
187 | * Specify page condition. |
||
188 | * @param string|int $pageSize It will return all models if it is 'all', |
||
189 | * or it will be regarded as sum of models. |
||
190 | * @param int $currentPage The current page number if it is integer begun with 0. |
||
191 | * @return $this |
||
192 | */ |
||
193 | 3 | public function page($pageSize = 10, $currentPage = 0) |
|
209 | } |
||
210 |
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: