Skip to content

Commit ec88f8d

Browse files
committed
TASK: QueryBuilder must act as a proxy for the method of the Request object
1 parent 8b5c0ef commit ec88f8d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Eel/ElasticSearchQueryBuilder.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\QueryInterface;
1515
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\ElasticSearchClient;
16+
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception;
1617
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception\QueryBuildingException;
1718
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\LoggerInterface;
1819
use TYPO3\Eel\ProtectedContextAwareInterface;
@@ -729,4 +730,22 @@ protected function convertHitsToNodes(array $hits)
729730

730731
return array_values($nodes);
731732
}
733+
734+
/**
735+
* Proxy method to access the public method of the Request object
736+
*
737+
* This is useful with custom Request type where not wrapper method exist in the QueryBuilder.
738+
*
739+
* @param string $method
740+
* @param array $args
741+
* @return $this
742+
* @throws Exception
743+
*/
744+
public function __call($method, array $args) {
745+
if (!method_exists($this->request, $method)) {
746+
throw new Exception(sprintf('Method "%s" does not exist in the current Request object "%s"', $method, get_class($this->request)), 1486763515);
747+
}
748+
call_user_func_array([$this->request, $method], $args);
749+
return $this;
750+
}
732751
}

0 commit comments

Comments
 (0)