@@ -69,6 +69,9 @@ |
||
| 69 | 69 | return $this->_dql; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @param string $dql |
|
| 74 | + */ |
|
| 72 | 75 | public function setDQL($dql) { |
| 73 | 76 | $this->_dql = $dql; |
| 74 | 77 | } |
@@ -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; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * |
| 188 | 188 | * @param object $entity The entity to delete. |
| 189 | 189 | * |
| 190 | - * @return bool TRUE if the entity got deleted in the database, FALSE otherwise. |
|
| 190 | + * @return boolean|null TRUE if the entity got deleted in the database, FALSE otherwise. |
|
| 191 | 191 | */ |
| 192 | 192 | public function delete($entity) { |
| 193 | 193 | // TODO: Implement delete() method. |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | * @param object $entity |
| 386 | 386 | * @param Criteria|null $extraConditions |
| 387 | 387 | * |
| 388 | - * @return boolean TRUE if the entity exists in the database, FALSE otherwise. |
|
| 388 | + * @return boolean|null TRUE if the entity exists in the database, FALSE otherwise. |
|
| 389 | 389 | */ |
| 390 | 390 | public function exists($entity, Criteria $extraConditions = null) { |
| 391 | 391 | // TODO: Implement exists() method. |
@@ -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); |
@@ -337,7 +337,7 @@ |
||
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | public function delete($entity) { |
| 340 | - if(!is_object($entity)){ |
|
| 340 | + if (!is_object($entity)) { |
|
| 341 | 341 | throw new InvalidArgumentException('Trying to schedule a non object to delete'); |
| 342 | 342 | } |
| 343 | 343 | |
@@ -241,6 +241,9 @@ discard block |
||
| 241 | 241 | $this->clear($entity); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | + /** |
|
| 245 | + * @param string $className |
|
| 246 | + */ |
|
| 244 | 247 | public function executeInserts($className) { |
| 245 | 248 | $persister = $this->getEntityPersister($className); |
| 246 | 249 | |
@@ -256,6 +259,9 @@ discard block |
||
| 256 | 259 | $persister->executeInserts(); |
| 257 | 260 | } |
| 258 | 261 | |
| 262 | + /** |
|
| 263 | + * @param string $className |
|
| 264 | + */ |
|
| 259 | 265 | public function executeUpdates($className) { |
| 260 | 266 | $persister = $this->getEntityPersister($className); |
| 261 | 267 | |
@@ -269,6 +275,9 @@ discard block |
||
| 269 | 275 | } |
| 270 | 276 | } |
| 271 | 277 | |
| 278 | + /** |
|
| 279 | + * @param string $className |
|
| 280 | + */ |
|
| 272 | 281 | public function executeDeletions($className) { |
| 273 | 282 | $persister = $this->getEntityPersister($className); |
| 274 | 283 | |
@@ -133,6 +133,6 @@ |
||
| 133 | 133 | /** @var Field[] $fields */ |
| 134 | 134 | $fields = (new AnnotationEntityHydrator())->extractSpecAnnotations($className, Field::class); |
| 135 | 135 | |
| 136 | - return isset($fields[$propertyName]) ? $fields[$propertyName]: null; |
|
| 136 | + return isset($fields[$propertyName]) ? $fields[$propertyName] : null; |
|
| 137 | 137 | } |
| 138 | 138 | } |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $queryParams = array_replace_recursive([ |
| 296 | 296 | 'size' => self::DEFAULT_MAX_RESULTS |
| 297 | - ], array_filter($queryParams, function ($value) { |
|
| 297 | + ], array_filter($queryParams, function($value) { |
|
| 298 | 298 | return $value !== null; |
| 299 | 299 | })); |
| 300 | 300 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | $url = "$index/$type/_search?" . http_build_query($queryParams); |
| 308 | 308 | |
| 309 | - $cleanQuery = function ($queryPart, callable $recusiveFn) { |
|
| 309 | + $cleanQuery = function($queryPart, callable $recusiveFn) { |
|
| 310 | 310 | if (!is_array($queryPart)) { |
| 311 | 311 | return $queryPart; |
| 312 | 312 | } |
@@ -491,6 +491,9 @@ |
||
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | + /** |
|
| 495 | + * @param string $index |
|
| 496 | + */ |
|
| 494 | 497 | private function validateIndex($index) { |
| 495 | 498 | if (!IndexHelper::indexIsValid($index)) { |
| 496 | 499 | throw new InvalidIndexNameException(sprintf( |
@@ -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 | $this->className = $className; |
| 58 | 61 | $this->annotationReader = new AnnotationReader(); |
@@ -94,6 +97,9 @@ discard block |
||
| 94 | 97 | } |
| 95 | 98 | } |
| 96 | 99 | |
| 100 | + /** |
|
| 101 | + * @param integer $offset |
|
| 102 | + */ |
|
| 97 | 103 | public function loadAll(array $criteria = [], array $orderBy = null, $limit = null, $offset = null) { |
| 98 | 104 | $type = $this->getEntityType(); |
| 99 | 105 | $sort = []; |
@@ -315,6 +321,9 @@ discard block |
||
| 315 | 321 | } |
| 316 | 322 | } |
| 317 | 323 | |
| 324 | + /** |
|
| 325 | + * @param integer $limit |
|
| 326 | + */ |
|
| 318 | 327 | public function load(array $criteria, $limit = null, array $orderBy = null) { |
| 319 | 328 | $results = $this->loadAll($criteria, $orderBy, $limit); |
| 320 | 329 | |