src/Utility/Search.php
protected function getWhereClause(array $data): array
    {
        $result = [];

        if (empty($data['criteria'])) {
            return $result;
        }

        // get current module searchable fields.
        $moduleFields = $this->filterFields(array_keys($this->searchFields));

        foreach ($data['criteria'] as $fieldName => $criterias) {
            if (empty($criterias)) {
                continue;
            }

            $fieldName = $this->table->aliasField($fieldName);
            if (!in_array($fieldName, $moduleFields)) {
                continue;
            }

            foreach ($criterias as $criteria) {
                $condition = $this->getWhereCondition($fieldName, $criteria);

                if (empty($condition)) {
                    continue;
                }
                $result[] = $condition;
            }
        }

        return $result;
    }
protected function getWhereClause(array $data): array
    {
        $result = [];

        if (empty($data['criteria'])) {
            return $result;
        }

        // get current module searchable fields.
        $moduleFields = $this->filterFields(array_keys($this->searchFields));

        foreach ($data['criteria'] as $fieldName => $criterias) {
            if (empty($criterias)) {
                continue;
            }

            $fieldName = $this->table->aliasField($fieldName);
            if (!in_array($fieldName, $moduleFields)) {
                continue;
            }

            foreach ($criterias as $criteria) {
                $condition = $this->getWhereCondition($fieldName, $criteria);

                if (empty($condition)) {
                    continue;
                }
                $result[] = $condition;
            }
        }

        return $result;
    }
protected function getWhereClause ( array $ data ) : array { $ result = [ ] ; if ( empty ( $ data [ 'criteria' ] ) ) { return $ result ; } // get current module searchable fields. $ moduleFields = $ this -> filterFields ( array_keys ( $ this -> searchFields ) ) ; foreach ( $ data [ 'criteria' ] as $ fieldName => $ criterias ) { if ( empty ( $ criterias ) ) { continue ; } $ fieldName = $ this -> table -> aliasField ( $ fieldName ) ; if ( ! in_array ( $ fieldName , $ moduleFields ) ) { continue ; } foreach ( $ criterias as $ criteria ) { $ condition = $ this -> getWhereCondition ( $ fieldName , $ criteria ) ; if ( empty ( $ condition ) ) { continue ; } $ result [ ] = $ condition ; } } return $ result ; }
Prepare search query's where statement

@param mixed[] $data request data
@return mixed[]
Prepare search query s where statement