Commit c1388c01 authored by Thierry Bugier's avatar Thierry Bugier Committed by Johan Cwiklinski

add complex criteria example

Signed-off-by: 's avatarThierry Bugier <tbugier@teclib.com>
parent bd561a1e
......@@ -346,6 +346,17 @@ Using the ``OR``, ``AND``, or ``NOT`` option with an array of criteria:
$DB->request('glpi_computers', ['NOT' => ['id' => [1,2,7]]]);
// => SELECT * FROM `glpi_computers` WHERE NOT (`id` IN (1, 2, 7))
Using a more complex expression with ``AND`` and ``OR``:
.. code-block:: php
<?php
$DB->request('glpi_computers', ['is_deleted' => 0,
['OR' => ['name' => 'foo', 'otherserial' => 'otherunique']],
['OR' => ['locations_id' => 1, 'serial' => 'unique']]
]);
// => SELECT * FROM `glpi_computers` WHERE `is_deleted` = '0' AND ((`name` = 'foo' OR `otherserial` = 'otherunique')) AND ((`locations_id` = '1' OR `serial` = 'unique'))
Operators
+++++++++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment