1 | <?php |
||
8 | abstract class Finder implements IFinder |
||
9 | { |
||
10 | protected $databaseName; |
||
11 | protected $select = '*'; |
||
12 | protected $from; |
||
13 | protected $where; |
||
14 | protected $orderBy = []; |
||
15 | protected $limit; |
||
16 | protected $offset; |
||
17 | protected $resultSet; |
||
18 | protected $client; |
||
19 | protected $mainLogical = '&&'; |
||
20 | protected $validGroups = [ |
||
21 | 'AND', |
||
22 | 'OR', |
||
23 | ]; |
||
24 | protected $validOperators = [ |
||
25 | '==', |
||
26 | '!=', |
||
27 | '<', |
||
28 | '>', |
||
29 | '<=', |
||
30 | '>=', |
||
31 | ]; |
||
32 | |||
33 | abstract protected function createClient(); |
||
35 | |||
36 | 8 | private function validateConditions($conditions) |
|
46 | |||
47 | 6 | private function validateCondition($condition) |
|
62 | |||
63 | 25 | public function __construct($client = null) |
|
71 | |||
72 | 6 | public function database($databaseName) |
|
77 | |||
78 | 2 | public function select($fieldList) |
|
83 | |||
84 | 6 | public function from($collectionName) |
|
89 | |||
90 | 8 | public function where($conditions) |
|
96 | |||
97 | 2 | public function orderBy($fieldName, $sortMode = 'ASC') |
|
102 | |||
103 | 2 | public function limit($limit) |
|
108 | |||
109 | 2 | public function offset($offset) |
|
114 | |||
115 | 4 | public function first() |
|
119 | |||
120 | 1 | public function all() |
|
124 | } |
||
125 |