Repository navigation
whereGroup
Corey Avis edited this page Sep 23, 2026
·
2 revisions
Compiles a nested array of conditions into a parenthesized SQL string, inverting the internal logical join to OR if the outer context is an AND block, or AND if the outer context is an OR block, and appends it to the query parts.
whereGroup(array $array): static
array (array)
: A sequential list of condition definitions, where each item is an associative array containing column, value, and op keys; previously normalized by the normalizeWhere method.
(static) : Returns the current instance to allow for method chaining.
private bool $orwhere = false;
$db->whereGroup([['column' => 'id', 'value' => 12, 'op' => '='], ['column' => 'user', 'value' => 'name', 'op' => '=']])
// Result: (`id` = 12 OR `user` = 'name')
private bool $orwhere = true;
$db->whereGroup([['column' => 'id', 'value' => 12, 'op' => '='], ['column' => 'user', 'value' => 'name', 'op' => '=']])
// Result: (`id` = 12 AND `user` = 'name')
The $orwhere boolean is set by the
andWhereandorWheremethods.
- No debug errors.
where | andWhere | orWhere | normalizeWhere | whereStr