Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function normalize(NormalizerInterface $normalizer, $format = null, array $context = [])
 {
     if ($this->getBuilder()) {
         $query = new FilteredQuery();
         !$this->isBool() ?: $this->getBuilder()->setParameters($this->getParameters());
         $query->setFilter($this->getBuilder());
         $this->addReference('filtered_query', $query);
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function normalize(NormalizerInterface $normalizer, $format = null, array $context = [])
 {
     if (!$this->getBool()) {
         return null;
     }
     $query = new FilteredQuery();
     if (!$this->getBool()->isRelevant()) {
         $filters = $this->getBool()->getQueries(BoolFilter::MUST);
         $filter = array_shift($filters);
     } else {
         $filter = $this->getBool();
     }
     $query->setFilter($filter);
     $this->addReference('filtered_query', $query);
 }