ParentId.php 962 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Elastica\Query;
  3. /**
  4. * ParentId query.
  5. *
  6. * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-parent-id-query.html
  7. */
  8. class ParentId extends AbstractQuery
  9. {
  10. /**
  11. * ParentId constructor.
  12. *
  13. * @param $type
  14. * @param $id
  15. * @param bool $ignoreUnmapped
  16. */
  17. public function __construct($type, $id, $ignoreUnmapped = false)
  18. {
  19. $this->setType($type);
  20. $this->setId($id);
  21. $this->setIgnoreUnmapped($ignoreUnmapped);
  22. }
  23. /**
  24. * @param string $type
  25. */
  26. private function setType(string $type)
  27. {
  28. $this->setParam('type', $type);
  29. }
  30. /**
  31. * @param int $id
  32. */
  33. private function setId($id)
  34. {
  35. $this->setParam('id', $id);
  36. }
  37. /**
  38. * @param bool $ignoreUnmapped
  39. */
  40. private function setIgnoreUnmapped($ignoreUnmapped)
  41. {
  42. $this->setParam('ignore_unmapped', $ignoreUnmapped);
  43. }
  44. }