src/CRUDlex/Controller.php
protected function buildUpListFilter(Request $request, EntityDefinition $definition, &$filter, &$filterActive, &$filterToUse, &$filterOperators)
    {
        $rawFilter = [];
        foreach ($definition->getFilter() as $filterField) {
            $type                    = $definition->getType($filterField);
            $filter[$filterField]    = $request->get('crudFilter'.$filterField);
            $rawFilter[$filterField] = $filter[$filterField];
            if ($filter[$filterField]) {
                $filterActive                  = true;
                $filterToUse[$filterField]     = $filter[$filterField];
                $filterOperators[$filterField] = '=';
                if ($type === 'boolean') {
                    $filterToUse[$filterField] = $filter[$filterField] == 'true' ? 1 : 0;
                } else if ($type === 'reference') {
                    $filter[$filterField] = ['id' => $filter[$filterField]];
                } else if ($type === 'many') {
                    $filter[$filterField] = array_map(function($value) {
                        return ['id' => $value];
                    }, $filter[$filterField]);
                    $filterToUse[$filterField] = $filter[$filterField];
                } else if (in_array($type, ['text', 'multiline', 'fixed'])) {
                    $filterToUse[$filterField]     = '%'.$filter[$filterField].'%';
                    $filterOperators[$filterField] = 'LIKE';
                }
            }
        }
        return $rawFilter;
    }
protected function buildUpListFilter(Request $request, EntityDefinition $definition, &$filter, &$filterActive, &$filterToUse, &$filterOperators)
    {
        $rawFilter = [];
        foreach ($definition->getFilter() as $filterField) {
            $type                    = $definition->getType($filterField);
            $filter[$filterField]    = $request->get('crudFilter'.$filterField);
            $rawFilter[$filterField] = $filter[$filterField];
            if ($filter[$filterField]) {
                $filterActive                  = true;
                $filterToUse[$filterField]     = $filter[$filterField];
                $filterOperators[$filterField] = '=';
                if ($type === 'boolean') {
                    $filterToUse[$filterField] = $filter[$filterField] == 'true' ? 1 : 0;
                } else if ($type === 'reference') {
                    $filter[$filterField] = ['id' => $filter[$filterField]];
                } else if ($type === 'many') {
                    $filter[$filterField] = array_map(function($value) {
                        return ['id' => $value];
                    }, $filter[$filterField]);
                    $filterToUse[$filterField] = $filter[$filterField];
                } else if (in_array($type, ['text', 'multiline', 'fixed'])) {
                    $filterToUse[$filterField]     = '%'.$filter[$filterField].'%';
                    $filterOperators[$filterField] = 'LIKE';
                }
            }
        }
        return $rawFilter;
    }
protected function buildUpListFilter ( Request $ request , EntityDefinition $ definition , & $ filter , & $ filterActive , & $ filterToUse , & $ filterOperators ) { $ rawFilter = [ ] ; foreach ( $ definition -> getFilter ( ) as $ filterField ) { $ type = $ definition -> getType ( $ filterField ) ; $ filter [ $ filterField ] = $ request -> get ( 'crudFilter' . $ filterField ) ; $ rawFilter [ $ filterField ] = $ filter [ $ filterField ] ; if ( $ filter [ $ filterField ] ) { $ filterActive = true ; $ filterToUse [ $ filterField ] = $ filter [ $ filterField ] ; $ filterOperators [ $ filterField ] = '=' ; if ( $ type === 'boolean' ) { $ filterToUse [ $ filterField ] = $ filter [ $ filterField ] == 'true' ? 1 : 0 ; } else if ( $ type === 'reference' ) { $ filter [ $ filterField ] = [ 'id' => $ filter [ $ filterField ] ] ; } else if ( $ type === 'many' ) { $ filter [ $ filterField ] = array_map ( function ( $ value ) { return [ 'id' => $ value ] ; } , $ filter [ $ filterField ] ) ; $ filterToUse [ $ filterField ] = $ filter [ $ filterField ] ; } else if ( in_array ( $ type , [ 'text' , 'multiline' , 'fixed' ] ) ) { $ filterToUse [ $ filterField ] = '%' . $ filter [ $ filterField ] . '%' ; $ filterOperators [ $ filterField ] = 'LIKE' ; } } } return $ rawFilter ; }
Builds up the parameters of the list page filters.

@param Request $request
the current request
@param EntityDefinition $definition
the current entity definition
@param array &$filter
will hold a map of fields to request parameters for the filters
@param boolean $filterActive
reference, will be true if at least one filter is active
@param array $filterToUse
reference, will hold a map of fields to integers (0 or 1) which boolean filters are active
@param array $filterOperators
reference, will hold a map of fields to operators for AbstractData::listEntries()

@return array
the raw filter query parameters
Builds up the parameters of the list page filters .