MidgardQueryBuilder method begin_group
void $qb->begin_group(str group_type)
begin_group is a method for grouping query constraints in Query Builder queries. Groups can be nested but always remember to close all groups, it is good practise to indent constraints in a group.
The method one argument:
group_typethe type of grouping.
Usage:
<?php
$qb = new MidgardQueryBuilder("midgard_article");
// List only articles in topic #123 OR topic #321
$qb->begin_group('OR');
$qb->add_constraint('topic', '=', 123);
$qb->add_constraint('topic', '=', 321);
$qb->end_group();
?>
Available group types
The following operators are supported:
ORfor matching any of the constraints in the groupANDfor matching all of the constraints in the group.
