diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Filter/HasParent.php | 50 |
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); } } |