1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Codappix\SearchCore\Domain\Model; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (C) 2019 Daniel Siepmann <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This program is free software; you can redistribute it and/or |
9
|
|
|
* modify it under the terms of the GNU General Public License |
10
|
|
|
* as published by the Free Software Foundation; either version 2 |
11
|
|
|
* of the License, or (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
* GNU General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU General Public License |
19
|
|
|
* along with this program; if not, write to the Free Software |
20
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
21
|
|
|
* 02110-1301, USA. |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
use TYPO3\CMS\Extbase\Persistence\QueryInterface; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Extbase QueryInterface |
28
|
|
|
* Current implementation covers only paginate widget support. |
29
|
|
|
*/ |
30
|
|
|
class Query implements QueryInterface |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @var int |
34
|
|
|
*/ |
35
|
|
|
private $offset = 0; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var int |
39
|
|
|
*/ |
40
|
|
|
private $limit = 10; |
41
|
|
|
|
42
|
|
|
public function execute($returnRawQueryResult = false) |
43
|
|
|
{ |
44
|
|
|
if (! ($this->connection instanceof ConnectionInterface)) { |
|
|
|
|
45
|
|
|
throw new \InvalidArgumentException( |
46
|
|
|
'Connection was not set before, therefore execute can not work. Use `setConnection` before.', |
47
|
|
|
1502197732 |
48
|
|
|
); |
49
|
|
|
} |
50
|
|
|
if (! ($this->searchService instanceof SearchService)) { |
|
|
|
|
51
|
|
|
throw new \InvalidArgumentException( |
52
|
|
|
'SearchService was not set before, therefore execute can not work. Use `setSearchService` before.', |
53
|
|
|
1520325175 |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
return $this->searchService->processResult($this->connection->search($this)); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function setLimit($limit) |
61
|
|
|
{ |
62
|
|
|
$this->limit = (int) $limit; |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function setOffset($offset) |
68
|
|
|
{ |
69
|
|
|
$this->offset = (int) $offset; |
70
|
|
|
|
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getLimit() |
75
|
|
|
{ |
76
|
|
|
return $this->limit; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function getOffset() |
80
|
|
|
{ |
81
|
|
|
return $this->offset; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getSource() |
85
|
|
|
{ |
86
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196146); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function setOrderings(array $orderings) |
90
|
|
|
{ |
91
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196163); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
public function matching($constraint) |
95
|
|
|
{ |
96
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196197); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function logicalAnd($constraint1) |
100
|
|
|
{ |
101
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196166); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function logicalOr($constraint1) |
105
|
|
|
{ |
106
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196198); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function logicalNot(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface $constraint) |
110
|
|
|
{ |
111
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196166); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function equals($propertyName, $operand, $caseSensitive = true) |
115
|
|
|
{ |
116
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196199); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function like($propertyName, $operand, $caseSensitive = true) |
120
|
|
|
{ |
121
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196199); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function contains($propertyName, $operand) |
125
|
|
|
{ |
126
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196200); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function in($propertyName, $operand) |
130
|
|
|
{ |
131
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196167); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function lessThan($propertyName, $operand) |
135
|
|
|
{ |
136
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196201); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function lessThanOrEqual($propertyName, $operand) |
140
|
|
|
{ |
141
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196168); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function greaterThan($propertyName, $operand) |
145
|
|
|
{ |
146
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196202); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function greaterThanOrEqual($propertyName, $operand) |
150
|
|
|
{ |
151
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196168); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function getType() |
155
|
|
|
{ |
156
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196203); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function setQuerySettings(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings) |
160
|
|
|
{ |
161
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196168); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public function getQuerySettings() |
165
|
|
|
{ |
166
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196205); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function count() |
170
|
|
|
{ |
171
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196169); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public function getOrderings() |
175
|
|
|
{ |
176
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196206); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
public function getConstraint() |
180
|
|
|
{ |
181
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196171); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
public function isEmpty($propertyName) |
185
|
|
|
{ |
186
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196207); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function setSource(\TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface $source) |
190
|
|
|
{ |
191
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196172); |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
public function getStatement() |
195
|
|
|
{ |
196
|
|
|
throw new \BadMethodCallException('Method is not implemented yet.', 1502196208); |
197
|
|
|
} |
198
|
|
|
} |
199
|
|
|
|