Open Source Content Management System

MidgardQueryBuilder method begin_group

  1. Usage:
  2. Available group types

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_type the 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:

  • OR for matching any of the constraints in the group
  • AND for matching all of the constraints in the group.
Designed by Nemein, hosted by Anykey