/** * {@inheritdoc} */ public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) { if ($this->hasReference('filtered_query')) { /** @var FilteredQuery $filteredQuery */ $filteredQuery = $this->getReference('filtered_query'); $this->add($filteredQuery); } if (!$this->bool) { return null; } $queryArray = $this->bool->toArray(); if ($this->bool->isRelevant()) { $queryArray = [$this->bool->getType() => $queryArray]; } return $queryArray; }
/** * Test getType method. */ public function testBoolGetType() { $bool = new BoolQuery(); $result = $bool->getType(); $this->assertEquals('bool', $result); }