23 private $fieldMapping;
28 private $appliedFields = [];
35 array $customJoins = [],
36 array $fieldMapping = []
38 $this->joins = $customJoins;
39 $this->fieldMapping = $fieldMapping;
54 foreach (
$group->getFilters() as $filter) {
55 if (!isset($this->appliedFields[$filter->getField()])) {
56 $this->applyCustomJoin($filter->getField(),
$collection);
57 $this->appliedFields[$filter->getField()] =
true;
66 if (!isset($this->appliedFields[
$order->getField()])) {
68 $this->appliedFields[
$order->getField()] =
true;
83 $field = $this->getFieldMapping($field);
84 $customJoin = $this->getCustomJoin($field);
98 private function getCustomJoin($field)
101 if (isset($this->joins[$field])) {
102 $filter = $this->joins[$field];
103 if (!($this->joins[$field] instanceof CustomJoinInterface)) {
104 throw new \InvalidArgumentException(
106 'Custom join for %s must implement %s interface.',
108 CustomJoinInterface::class
122 private function getFieldMapping($field)
124 return $this->fieldMapping[$field] ?? $field;
__construct(array $customJoins=[], array $fieldMapping=[])
process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection)