Skip to content
Snippets Groups Projects
Commit 4b2cab9e authored by Linas Mockus's avatar Linas Mockus
Browse files

Added NestedFilter.

parent 1d74bb2c
No related branches found
No related tags found
No related merge requests found
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchBundle\DSL\Filter;
use ONGR\ElasticsearchBundle\DSL\BuilderInterface;
use ONGR\ElasticsearchBundle\DSL\ParametersTrait;
/**
* Nested filter implementation.
*/
class NestedFilter implements BuilderInterface
{
use ParametersTrait;
/**
* @var string
*/
private $path;
/**
* @var BuilderInterface
*/
private $query;
/**
* @var array
*/
private $parameters;
/**
* @param string $path
* @param BuilderInterface $query
* @param array $parameters
*/
public function __construct($path, BuilderInterface $query, array $parameters = [])
{
$this->path = $path;
$this->query = $query;
$this->parameters = $parameters;
}
/**
* {@inheritdoc}
*/
public function getType()
{
return 'nested';
}
/**
* {@inheritdoc}
*/
public function toArray()
{
$query = [
'path' => $this->path,
'filter' => [
$this->query->getType() => $this->query->toArray(),
],
];
$output = $this->processArray($query);
return $output;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment