/** * @param string $itemName The property name * @param SearchQueryExpr $value The sub query * @return string */ protected function processSubQueryValue($itemName, SearchQueryExpr $value) { if ($value->isEmpty()) { return ''; } $result = $this->processExpr($value, $itemName); if ($value->isComplex()) { $result = sprintf('(%s)', $result); } return $result; }
/** * {@inheritdoc} */ protected function processSubQueryValue($itemName, SearchQueryExpr $value) { if ($value->isEmpty()) { return ''; } if ($itemName !== null) { $keyword = $this->getKeyword($itemName); if (!$keyword) { throw new \InvalidArgumentException(sprintf('Unsupported property "%s".', $itemName)); } $result = sprintf('%s%s', $keyword, $this->getNameValueDelimiter()); } else { $result = ''; } $expr = $this->processExpr($value); $result .= $value->isComplex() ? sprintf('(%s)', $expr) : $expr; return $result; }
/** * Checks if this query has no any expressions. * * @return bool */ public function isEmpty() { return $this->expr->isEmpty(); }