summaryrefslogtreecommitdiff
path: root/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php')
-rw-r--r--vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php50
1 files changed, 21 insertions, 29 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php b/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
index de49e470..73a2dc5a 100644
--- a/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
+++ b/vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php
@@ -1,21 +1,18 @@
<?php
-
namespace Elastica\Filter;
/**
- * Returns child documents having parent docs matching the query
+ * Returns child documents having parent docs matching the query.
*
- * @category Xodoa
- * @package Elastica
- * @link http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-filter.html
+ * @link http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-has-parent-filter.html
*/
class HasParent extends AbstractFilter
{
/**
- * Construct HasParent filter
+ * Construct HasParent filter.
*
* @param string|\Elastica\Query|\Elastica\Filter\AbstractFilter $query Query string or a Query object or a filter
- * @param string $type Parent document type
+ * @param string|\Elastica\Type $type Parent document type
*/
public function __construct($query, $type)
{
@@ -28,10 +25,11 @@ class HasParent extends AbstractFilter
}
/**
- * Sets query object
+ * Sets query object.
+ *
+ * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query
*
- * @param string|\Elastica\Query|\Elastica\Query\AbstractQuery $query
- * @return \Elastica\Filter\HasParent Current object
+ * @return $this
*/
public function setQuery($query)
{
@@ -42,36 +40,30 @@ class HasParent extends AbstractFilter
}
/**
- * Sets query object
+ * Sets filter object.
+ *
+ * @param \Elastica\Filter\AbstractFilter $filter
*
- * @param \Elastica\Filter\AbstractFilter $filter
- * @return \Elastica\Filter\HasParent Current object
+ * @return $this
*/
public function setFilter($filter)
{
- $data = $filter->toArray();
- return $this->setParam('filter', $data);
+ return $this->setParam('filter', $filter->toArray());
}
/**
- * Set type of the parent document
+ * Set type of the parent document.
*
- * @param string $type Parent document type
- * @return \Elastica\Filter\HasParent Current object
+ * @param string|\Elastica\Type $type Parent document type
+ *
+ * @return $this
*/
public function setType($type)
{
- return $this->setParam('type', $type);
- }
+ if ($type instanceof \Elastica\Type) {
+ $type = $type->getName();
+ }
- /**
- * Sets the scope
- *
- * @param string $scope Scope
- * @return \Elastica\Filter\HasParent Current object
- */
- public function setScope($scope)
- {
- return $this->setParam('_scope', $scope);
+ return $this->setParam('type', (string) $type);
}
}