vtwsclib-php icon indicating copy to clipboard operation
vtwsclib-php copied to clipboard

A small suggestion WHERE conditions

Open psad73 opened this issue 3 years ago • 0 comments

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>Entities.php (<b>1 gru 2021, 13:09:39</b>)</html>
+++ b/<html><b>Current File</b></html>
@@ -276,8 +276,14 @@
 
         if (!empty($params)) {
             foreach ($params as $param => $value) {
+                if (is_array($value)) {
+                    $op = $value[0];
+                    $val = $value[1];
+                    $criteria[] = "{$param} {$op} '{$val}'";
+                } else {
                 $criteria[] = "{$param} LIKE '{$value}'";
             }
+            }
 
             $query .= sprintf(' WHERE %s', implode(" AND ", $criteria));
         }

this may be usefull. It allows to specify more precise WHERE conditions for queries. Example:

$vtigerClient->entities->findMany('HelpDesk', ['createdtime ' => ['>', '2020-01-01'], 'createdtime' => ['<', '2020-04-16']]);

This will look for tickets created between given dates.

psad73 avatar Jan 06 '22 10:01 psad73