src/Budkit/Datastore/Activerecord.php
final public function like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
    {
        if (!is_array($field)) {
            $field = array($field => $match);
        }
        foreach ($field as $k => $v) {
            $k = $this->identifiers($k);

            $prefix = (count($this->arrayLike) == 0) ? '' : $type;
            $v = $this->escape($v);
            $likeStatement = '';
            if ($side == 'before') {
                $likeStatement = $prefix . " $k $not LIKE '%{$v}'";
            } elseif ($side == 'after') {
                $likeStatement = $prefix . " $k $not LIKE '{$v}%'";
            } else {
                $likeStatement = $prefix . " $k $not LIKE '%{$v}%'";
            }

            $this->arrayLike[] = $likeStatement;
            if ($this->arrayCaching === TRUE) {
                $this->arrayCacheLike[] = $likeStatement;
                $this->arrayCacheExists[] = 'like';
            }
        }
        return $this;
    }
final public function like($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
    {
        if (!is_array($field)) {
            $field = array($field => $match);
        }
        foreach ($field as $k => $v) {
            $k = $this->identifiers($k);

            $prefix = (count($this->arrayLike) == 0) ? '' : $type;
            $v = $this->escape($v);
            $likeStatement = '';
            if ($side == 'before') {
                $likeStatement = $prefix . " $k $not LIKE '%{$v}'";
            } elseif ($side == 'after') {
                $likeStatement = $prefix . " $k $not LIKE '{$v}%'";
            } else {
                $likeStatement = $prefix . " $k $not LIKE '%{$v}%'";
            }

            $this->arrayLike[] = $likeStatement;
            if ($this->arrayCaching === TRUE) {
                $this->arrayCacheLike[] = $likeStatement;
                $this->arrayCacheExists[] = 'like';
            }
        }
        return $this;
    }
final public function like ( $ field , $ match = '' , $ type = 'AND ' , $ side = 'both' , $ not = '' ) { if ( ! is_array ( $ field ) ) { $ field = array ( $ field => $ match ) ; } foreach ( $ field as $ k => $ v ) { $ k = $ this -> identifiers ( $ k ) ; $ prefix = ( count ( $ this -> arrayLike ) == 0 ) ? '' : $ type ; $ v = $ this -> escape ( $ v ) ; $ likeStatement = '' ; if ( $ side == 'before' ) { $ likeStatement = $ prefix . " $k $not LIKE '%{$v}'" ; } elseif ( $ side == 'after' ) { $ likeStatement = $ prefix . " $k $not LIKE '{$v}%'" ; } else { $ likeStatement = $ prefix . " $k $not LIKE '%{$v}%'" ; } $ this -> arrayLike [ ] = $ likeStatement ; if ( $ this -> arrayCaching === TRUE ) { $ this -> arrayCacheLike [ ] = $ likeStatement ; $ this -> arrayCacheExists [ ] = 'like' ; } } return $ this ; }
Adds a LIKE cluase to the query statement

@param string $field
@param string $match
@param string $type
@param string $side
@param string $not
@return ActiveRecord
Adds a LIKE cluase to the query statement