src/DcGeneral/Data/FilterBuilder.php
private function getFilterForLike($attribute, IFilter $filter, $operation)
    {
        if ($attribute) {
            $filter->addFilterRule(new SearchAttribute(
                $attribute,
                $operation['value'],
                $this->getMetaModel()->getAvailableLanguages() ?: array()
            ));

            return;
        }

        $columns = $this->connection->getSchemaManager()->listTableColumns($this->getMetaModel()->getTableName());
        if ($columns[$operation['property']]) {
            // System column?
            $filter->addFilterRule(new SimpleQuery(
                sprintf(
                    'SELECT id FROM %s WHERE %s LIKE ?',
                    $this->getMetaModel()->getTableName(),
                    $operation['property']
                ),
                array($operation['value']),
                'id',
                $this->connection
            ));

            return;
        }

        throw new \RuntimeException(
            'Error processing filter array - unknown property ' . var_export($operation['property'], true),
            1
        );
    }
private function getFilterForLike($attribute, IFilter $filter, $operation)
    {
        if ($attribute) {
            $filter->addFilterRule(new SearchAttribute(
                $attribute,
                $operation['value'],
                $this->getMetaModel()->getAvailableLanguages() ?: array()
            ));

            return;
        }

        $columns = $this->connection->getSchemaManager()->listTableColumns($this->getMetaModel()->getTableName());
        if ($columns[$operation['property']]) {
            // System column?
            $filter->addFilterRule(new SimpleQuery(
                sprintf(
                    'SELECT id FROM %s WHERE %s LIKE ?',
                    $this->getMetaModel()->getTableName(),
                    $operation['property']
                ),
                array($operation['value']),
                'id',
                $this->connection
            ));

            return;
        }

        throw new \RuntimeException(
            'Error processing filter array - unknown property ' . var_export($operation['property'], true),
            1
        );
    }
private function getFilterForLike ( $ attribute , IFilter $ filter , $ operation ) { if ( $ attribute ) { $ filter -> addFilterRule ( new SearchAttribute ( $ attribute , $ operation [ 'value' ] , $ this -> getMetaModel ( ) -> getAvailableLanguages ( ) ? : array ( ) ) ) ; return ; } $ columns = $ this -> connection -> getSchemaManager ( ) -> listTableColumns ( $ this -> getMetaModel ( ) -> getTableName ( ) ) ; if ( $ columns [ $ operation [ 'property' ] ] ) { // System column? $ filter -> addFilterRule ( new SimpleQuery ( sprintf ( 'SELECT id FROM %s WHERE %s LIKE ?' , $ this -> getMetaModel ( ) -> getTableName ( ) , $ operation [ 'property' ] ) , array ( $ operation [ 'value' ] ) , 'id' , $ this -> connection ) ) ; return ; } throw new \ RuntimeException ( 'Error processing filter array - unknown property ' . var_export ( $ operation [ 'property' ] , true ) , 1 ) ; }
Return the filter query for a "foo LIKE '%ba_r%'" filter.

The searched value may contain the wildcards '*' and '?' which will get converted to proper SQL.

@param IAttribute $attribute The attribute.

@param IFilter    $filter    The filter to add the operations to.

@param array      $operation The operation to convert.

@return void

@throws \RuntimeException When the operation can not be parsed.
Return the filter query for a foo LIKE %ba_r% filter .