Ejemplo n.º 1
0
 /**
  * {@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;
 }
Ejemplo n.º 2
0
 /**
  * Test getType method.
  */
 public function testBoolGetType()
 {
     $bool = new BoolQuery();
     $result = $bool->getType();
     $this->assertEquals('bool', $result);
 }