@@ 337-351 (lines=15) @@ | ||
334 | * @param EntityMetadata $metadata |
|
335 | * @return array|null |
|
336 | */ |
|
337 | private function formatQueryElementId($key, $value, EntityMetadata $metadata) |
|
338 | { |
|
339 | if (false === $this->isIdentifierField($key)) { |
|
340 | return; |
|
341 | } |
|
342 | ||
343 | $dbIdKey = Persister::IDENTIFIER_KEY; |
|
344 | $converter = $this->getQueryIdConverter($metadata); |
|
345 | ||
346 | if (is_array($value)) { |
|
347 | $value = (true === $this->hasOperators($value)) ? $value : ['$in' => $value]; |
|
348 | return [$dbIdKey, $this->formatQueryExpression($value, $converter)]; |
|
349 | } |
|
350 | return [$dbIdKey, $converter($value)]; |
|
351 | } |
|
352 | ||
353 | /** |
|
354 | * Formats a relationship query element. |
|
@@ 391-405 (lines=15) @@ | ||
388 | * @param mixed $value |
|
389 | * @return array|null |
|
390 | */ |
|
391 | private function formatQueryElementType($key, $value) |
|
392 | { |
|
393 | if (false === $this->isTypeField($key)) { |
|
394 | return; |
|
395 | } |
|
396 | ||
397 | $dbTypeKey = Persister::POLYMORPHIC_KEY; |
|
398 | $converter = $this->getQueryTypeConverter(); |
|
399 | ||
400 | if (is_array($value)) { |
|
401 | $value = (true === $this->hasOperators($value)) ? $value : ['$in' => $value]; |
|
402 | return [$dbTypeKey, $this->formatQueryExpression($value, $converter)]; |
|
403 | } |
|
404 | return [$dbTypeKey, $converter($value)]; |
|
405 | } |
|
406 | ||
407 | /** |
|
408 | * Formats a query expression. |