Pommo_Sql::getLogic PHP Method

getLogic() public method

...
public getLogic ( &$col, &$val, &$filters )
    function getLogic(&$col, &$val, &$filters)
    {
        if (is_array($val)) {
            foreach ($val as $v) {
                Pommo_Sql::getLogic($col, $v, $filters);
            }
        } else {
            // extract logic ($matches[1]) + value ($matches[2])
            preg_match('/^(?:(not|is|less|greater|true|false|equal|like):)?(.*)$/i', $val, $matches);
            if (!empty($matches[1])) {
                if (empty($filters[$col])) {
                    $filters[$col] = array();
                }
                if (empty($filters[$col][$matches[1]])) {
                    $filters[$col][$matches[1]] = array();
                }
                array_push($filters[$col][$matches[1]], trim($matches[2]));
            }
        }
    }

Usage Example

Exemplo n.º 1
0
 function getLogic(&$col, &$val, &$filters)
 {
     if (is_array($val)) {
         foreach ($val as $v) {
             Pommo_Sql::getLogic($col, $v, $filters);
         }
     } else {
         // extract logic ($matches[1]) + value ($matches[2])
         preg_match('/^(?:(not|is|less|greater|true|false|equal|like):)?(.*)$/i', $val, $matches);
         if (!empty($matches[1])) {
             if (empty($filters[$col])) {
                 $filters[$col] = array();
             }
             if (empty($filters[$col][$matches[1]])) {
                 $filters[$col][$matches[1]] = array();
             }
             array_push($filters[$col][$matches[1]], trim($matches[2]));
         }
     }
 }