@@ -44,6 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | private $fieldAnnotations = []; |
46 | 46 | |
47 | + /** |
|
48 | + * @param string $className |
|
49 | + */ |
|
47 | 50 | public function __construct(ElasticQuery $query, $className, WalkerHelper $walkerHelper) { |
48 | 51 | $this->query = $query; |
49 | 52 | $this->className = $className; |
@@ -96,6 +99,9 @@ discard block |
||
96 | 99 | $this->walkTermsAndFactors($termsAndFactors, $searchParams); |
97 | 100 | } |
98 | 101 | |
102 | + /** |
|
103 | + * @param SearchParams $searchParams |
|
104 | + */ |
|
99 | 105 | private function walkTermsAndFactors(array $termsAndFactors, $searchParams) { |
100 | 106 | foreach ($termsAndFactors['factors'] as $factor) { |
101 | 107 | $this->walkANDFactor($factor, $searchParams); |
@@ -251,6 +257,9 @@ discard block |
||
251 | 257 | $this->addBodyStatement($field, $operator, null, $searchParams); |
252 | 258 | } |
253 | 259 | |
260 | + /** |
|
261 | + * @param string $field |
|
262 | + */ |
|
254 | 263 | private function addBodyStatement($field, $operator, $value, SearchParams $searchParams) { |
255 | 264 | $body = $searchParams->getBody(); |
256 | 265 | $this->walkerHelper->addBodyStatement($field, $operator, $value, $body); |
@@ -2,14 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace DoctrineElastic\Elastic; |
4 | 4 | |
5 | -use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; |
|
6 | -use Doctrine\DBAL\Connection; |
|
7 | -use Doctrine\ORM\Configuration; |
|
8 | -use Doctrine\ORM\EntityManager; |
|
9 | -use Doctrine\ORM\Mapping\Driver\AnnotationDriver; |
|
10 | 5 | use Doctrine\ORM\Query; |
11 | -use Doctrine\ORM\Query\Parser; |
|
12 | -use DoctrineElastic\DoctrineMock\GetConfigurationEntityManager; |
|
13 | 6 | use DoctrineElastic\ElasticEntityManager; |
14 | 7 | use DoctrineElastic\Query\QueryParser; |
15 | 8 | use DoctrineElastic\Query\ElasticQueryExecutor; |
@@ -59,6 +59,9 @@ |
||
59 | 59 | return $this->_dql; |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $dql |
|
64 | + */ |
|
62 | 65 | public function setDQL($dql) |
63 | 66 | { |
64 | 67 | $this->_dql = $dql; |
@@ -246,6 +246,9 @@ discard block |
||
246 | 246 | $this->clear($entity); |
247 | 247 | } |
248 | 248 | |
249 | + /** |
|
250 | + * @param string $className |
|
251 | + */ |
|
249 | 252 | public function executeInserts($className) |
250 | 253 | { |
251 | 254 | $persister = $this->getEntityPersister($className); |
@@ -262,6 +265,9 @@ discard block |
||
262 | 265 | $persister->executeInserts(); |
263 | 266 | } |
264 | 267 | |
268 | + /** |
|
269 | + * @param string $className |
|
270 | + */ |
|
265 | 271 | public function executeUpdates($className) |
266 | 272 | { |
267 | 273 | $persister = $this->getEntityPersister($className); |
@@ -276,6 +282,9 @@ discard block |
||
276 | 282 | } |
277 | 283 | } |
278 | 284 | |
285 | + /** |
|
286 | + * @param string $className |
|
287 | + */ |
|
279 | 288 | public function executeDeletions($className) |
280 | 289 | { |
281 | 290 | $persister = $this->getEntityPersister($className); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * |
187 | 187 | * @param object $entity The entity to delete. |
188 | 188 | * |
189 | - * @return bool TRUE if the entity got deleted in the database, FALSE otherwise. |
|
189 | + * @return boolean|null TRUE if the entity got deleted in the database, FALSE otherwise. |
|
190 | 190 | */ |
191 | 191 | public function delete($entity) |
192 | 192 | { |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @param object $entity |
399 | 399 | * @param Criteria|null $extraConditions |
400 | 400 | * |
401 | - * @return boolean TRUE if the entity exists in the database, FALSE otherwise. |
|
401 | + * @return boolean|null TRUE if the entity exists in the database, FALSE otherwise. |
|
402 | 402 | */ |
403 | 403 | public function exists($entity, Criteria $extraConditions = null) |
404 | 404 | { |
@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | /** @var WalkerHelper */ |
54 | 54 | private $walkerHelper; |
55 | 55 | |
56 | + /** |
|
57 | + * @param string $className |
|
58 | + */ |
|
56 | 59 | public function __construct(ElasticEntityManager $em, $className) |
57 | 60 | { |
58 | 61 | $this->className = $className; |
@@ -96,6 +99,9 @@ discard block |
||
96 | 99 | } |
97 | 100 | } |
98 | 101 | |
102 | + /** |
|
103 | + * @param integer $offset |
|
104 | + */ |
|
99 | 105 | public function loadAll(array $criteria = [], array $orderBy = null, $limit = null, $offset = null) |
100 | 106 | { |
101 | 107 | $type = $this->getEntityType(); |
@@ -300,6 +306,9 @@ discard block |
||
300 | 306 | } |
301 | 307 | } |
302 | 308 | |
309 | + /** |
|
310 | + * @param integer $limit |
|
311 | + */ |
|
303 | 312 | public function load(array $criteria, $limit = null, array $orderBy = null) |
304 | 313 | { |
305 | 314 | $results = $this->loadAll($criteria, $orderBy, $limit); |
@@ -61,16 +61,16 @@ |
||
61 | 61 | private function registerEventsListeners() |
62 | 62 | { |
63 | 63 | $this->getEventManager() |
64 | - ->addEventListener([DoctrineElasticEvents::beforeInsert, DoctrineElasticEvents::postInsert,], new InsertListener()); |
|
64 | + ->addEventListener([DoctrineElasticEvents::beforeInsert, DoctrineElasticEvents::postInsert, ], new InsertListener()); |
|
65 | 65 | |
66 | 66 | $this->getEventManager() |
67 | - ->addEventListener([DoctrineElasticEvents::beforeDelete, DoctrineElasticEvents::postDelete,], new DeleteListener()); |
|
67 | + ->addEventListener([DoctrineElasticEvents::beforeDelete, DoctrineElasticEvents::postDelete, ], new DeleteListener()); |
|
68 | 68 | |
69 | 69 | $this->getEventManager() |
70 | - ->addEventListener([DoctrineElasticEvents::beforeDelete, DoctrineElasticEvents::postDelete,], new UpdateListener()); |
|
70 | + ->addEventListener([DoctrineElasticEvents::beforeDelete, DoctrineElasticEvents::postDelete, ], new UpdateListener()); |
|
71 | 71 | |
72 | 72 | $this->getEventManager() |
73 | - ->addEventListener([DoctrineElasticEvents::beforeQuery, DoctrineElasticEvents::postQuery,], new QueryListener()); |
|
73 | + ->addEventListener([DoctrineElasticEvents::beforeQuery, DoctrineElasticEvents::postQuery, ], new QueryListener()); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | $baseHost = reset($hosts); |
41 | 41 | |
42 | 42 | if (empty($baseHost) |
43 | - || ! is_string($baseHost) |
|
44 | - || ! preg_match('/http/', $baseHost)) { |
|
43 | + || !is_string($baseHost) |
|
44 | + || !preg_match('/http/', $baseHost)) { |
|
45 | 45 | throw new ConnectionException("Elasticsearch host is invalid. "); |
46 | 46 | } |
47 | 47 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | $queryParams = array_replace_recursive( |
332 | 332 | ['size' => self::DEFAULT_MAX_RESULTS], |
333 | - array_filter($queryParams, function ($value) { |
|
333 | + array_filter($queryParams, function($value) { |
|
334 | 334 | return $value !== null; |
335 | 335 | }) |
336 | 336 | ); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | $url = "$index/$type/_search?" . http_build_query($queryParams); |
345 | 345 | |
346 | - $cleanQuery = function ($queryPart, callable $recusiveFn) { |
|
346 | + $cleanQuery = function($queryPart, callable $recusiveFn) { |
|
347 | 347 | if (!is_array($queryPart)) { |
348 | 348 | return $queryPart; |
349 | 349 | } |