src/Budkit/Datastore/Model/Entity.php
final public function setListLookUpConditions($key, $value = NULL, $type = 'AND', $exact = FALSE, $escape = TRUE, $comparison = "LIKE")
    {

        if (empty($key)) {
            return $this;
        }
        if (!is_array($key)) {
            if (is_null($value)) { //some values could be '' so don't use empty here
                return $this;
            }
            $key = array($key => $value);
        }
        //print_R($key);
        $dataModel = $this->getPropertyModel();
        foreach ($key as $k => $v) {

            //For count queries, we will only add properties if their value is in having or where clause;
            if (array_key_exists($k, $dataModel)):
                $this->listLookUpConditionProperties[] = $k;
            endif;

            //The firs item adds the and prefix;
            $prefix = (count($this->listLookUpConditions) == 0 AND count($this->listLookUpConditions) == 0) ? '' : $type . "\t";
            if ($escape === TRUE) {
                $v = $this->database->escape($v);
                //$v = $this->quote( stripslashes($v) );
            }
            if (empty($v)) {
                // value appears not to have been set, assign the test to IS NULL 
                // IFNULL(xxx, '')
                $v = " IS NULL";
            } else {
                if (is_array($v)):
                    $_values = array_map(array($this->database, "quote"), $v);
                    $values = implode(',', $_values);
                    $v = " IN ($values)";
                else:
                    $v = (strtoupper($comparison) == "LIKE") ? " LIKE '%{$v}%'" : " {$comparison} '{$v}'";
                endif;
            }
            if ($exact && is_array($this->listLookUpConditions) && !empty($this->listLookUpConditions)):
                $conditions = implode("\t", $this->listLookUpConditions);
                $this->listLookUpConditions = array();
                $this->listLookUpConditions[] = "(" . $conditions . ")";
            endif;
            $this->listLookUpConditions[] = $prefix . $k . $v;
        }

        return $this;
    }
final public function setListLookUpConditions($key, $value = NULL, $type = 'AND', $exact = FALSE, $escape = TRUE, $comparison = "LIKE")
    {

        if (empty($key)) {
            return $this;
        }
        if (!is_array($key)) {
            if (is_null($value)) { //some values could be '' so don't use empty here
                return $this;
            }
            $key = array($key => $value);
        }
        //print_R($key);
        $dataModel = $this->getPropertyModel();
        foreach ($key as $k => $v) {

            //For count queries, we will only add properties if their value is in having or where clause;
            if (array_key_exists($k, $dataModel)):
                $this->listLookUpConditionProperties[] = $k;
            endif;

            //The firs item adds the and prefix;
            $prefix = (count($this->listLookUpConditions) == 0 AND count($this->listLookUpConditions) == 0) ? '' : $type . "\t";
            if ($escape === TRUE) {
                $v = $this->database->escape($v);
                //$v = $this->quote( stripslashes($v) );
            }
            if (empty($v)) {
                // value appears not to have been set, assign the test to IS NULL 
                // IFNULL(xxx, '')
                $v = " IS NULL";
            } else {
                if (is_array($v)):
                    $_values = array_map(array($this->database, "quote"), $v);
                    $values = implode(',', $_values);
                    $v = " IN ($values)";
                else:
                    $v = (strtoupper($comparison) == "LIKE") ? " LIKE '%{$v}%'" : " {$comparison} '{$v}'";
                endif;
            }
            if ($exact && is_array($this->listLookUpConditions) && !empty($this->listLookUpConditions)):
                $conditions = implode("\t", $this->listLookUpConditions);
                $this->listLookUpConditions = array();
                $this->listLookUpConditions[] = "(" . $conditions . ")";
            endif;
            $this->listLookUpConditions[] = $prefix . $k . $v;
        }

        return $this;
    }
final public function setListLookUpConditions ( $ key , $ value = NULL , $ type = 'AND' , $ exact = FALSE , $ escape = TRUE , $ comparison = "LIKE" ) { if ( empty ( $ key ) ) { return $ this ; } if ( ! is_array ( $ key ) ) { if ( is_null ( $ value ) ) { //some values could be '' so don't use empty here return $ this ; } $ key = array ( $ key => $ value ) ; } //print_R($key); $ dataModel = $ this -> getPropertyModel ( ) ; foreach ( $ key as $ k => $ v ) { //For count queries, we will only add properties if their value is in having or where clause; if ( array_key_exists ( $ k , $ dataModel ) ) : $ this -> listLookUpConditionProperties [ ] = $ k ; endif ; //The firs item adds the and prefix; $ prefix = ( count ( $ this -> listLookUpConditions ) == 0 AND count ( $ this -> listLookUpConditions ) == 0 ) ? '' : $ type . "\t" ; if ( $ escape === TRUE ) { $ v = $ this -> database -> escape ( $ v ) ; //$v = $this->quote( stripslashes($v) ); } if ( empty ( $ v ) ) { // value appears not to have been set, assign the test to IS NULL  // IFNULL(xxx, '') $ v = " IS NULL" ; } else { if ( is_array ( $ v ) ) : $ _values = array_map ( array ( $ this -> database , "quote" ) , $ v ) ; $ values = implode ( ',' , $ _values ) ; $ v = " IN ($values)" ; else : $ v = ( strtoupper ( $ comparison ) == "LIKE" ) ? " LIKE '%{$v}%'" : " {$comparison} '{$v}'" ; endif ; } if ( $ exact && is_array ( $ this -> listLookUpConditions ) && ! empty ( $ this -> listLookUpConditions ) ) : $ conditions = implode ( "\t" , $ this -> listLookUpConditions ) ; $ this -> listLookUpConditions = array ( ) ; $ this -> listLookUpConditions [ ] = "(" . $ conditions . ")" ; endif ; $ this -> listLookUpConditions [ ] = $ prefix . $ k . $ v ; } return $ this ; }
Sets lookup conditions for entity table search

@param type $key
@param type $value
@param type $type
@param type $exact
@param type $escape
@return \Platform\Entity
Sets lookup conditions for entity table search