for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace TBolier\RethinkQL\Query\Operation;
use TBolier\RethinkQL\Query\AbstractQuery;
use TBolier\RethinkQL\Query\Aggregation\AggregationTrait;
use TBolier\RethinkQL\Query\Manipulation\ManipulationTrait;
use TBolier\RethinkQL\Query\QueryInterface;
use TBolier\RethinkQL\Query\Transformation\TransformationTrait;
use TBolier\RethinkQL\RethinkInterface;
use TBolier\RethinkQL\Types\Term\TermType;
class Filter extends AbstractQuery
{
use TransformationTrait;
use OperationTrait;
use AggregationTrait;
use ManipulationTrait;
/**
* @var array
*/
private $predicate;
* @var QueryInterface
private $query;
public function __construct(
RethinkInterface $rethink,
QueryInterface $query,
array $predicate
) {
parent::__construct($rethink);
$this->query = $query;
$this->predicate = [$predicate];
$this->rethink = $rethink;
}
public function toArray(): array
$jsonDocuments = [];
foreach ($this->predicate as $key => $document) {
$jsonDocuments[] = json_encode($document);
return [
TermType::FILTER,
[
$this->query->toArray(),
TermType::JSON,
$jsonDocuments,
],
];