Documentation

GetList

CDBResult
CBlogGroup::GetList(
 array arOrder = Array("ID"=>"DESC"),
 array arFilter = Array(),
 bool  arGroupBy = false,
 bool  arNavStartParams = false,
 array arSelectFields = Array()
);

The method returns list of groups by the arFilter, sorted by the arOrder. Non-static method.

Method parameters

ParameterDescription
arOrder Array for sorting of results. Array of the array("sorting field"=>"sorting direction" [, ...]) type Field for sorting can have the following values:
  • ID - category ID;
  • SITE_ID - site ID;
  • NAME - category name.
Optional. By default, filtering is performed by descension of category ID.
arFilter Array of the array("filtered field"=>"filter value" [, ...]) type. Filtered field can have the following values:
  • ID - category ID;
  • SITE_ID - site ID;
  • NAME - category name.
The type of filtration can be specified in front of name of filtered field:
  • "!" - not equal
  • "<" - less
  • "<=" - less or equal
  • ">" - more
  • ">=" - more or equal

"filter value" - single value or an array.

Optional. By default, records are not filtered.
arGroupBy Array of fields, by which the records are grouped. The array has the following structure:
array("field_name1",
      "aggregate_function1" => "field_name2", ...)
Any field can be specified as "field_nameN". The following can be specified as the aggregate function:
  • COUNT - quantity count;
  • AVG - average value calculation;
  • MIN - minimal value calculation;
  • MAX - maximum value calculation;
  • SUM - sum calculation.
If the array is empty, the array will return the number of records, satisfying the filter.
Optional. By default - false - means that the result will not be grouped.
arNavStartParams Array of sample parameters. Can contain the following keys:
  • "nTopCount" - number of records returned by the method will be limited from above by the value of this key
  • any key, accepted by the CDBResult::NavQuery method as the third parameter.
Optional. By default - false - means that there are no sample parameters.
arSelectFields Array of records, which will be returned by the method. Only those fields that are needed can be specified. If there is a "*" value in the array - all available fields will be returned.

Optional. By default - empty array() - means that all fields of the request's main table will be returned.

Returned value

CDBResult object is returned.

Examples of use

<?
// select all site groups with the "com" ID
$arOrder = Array(
        "NAME" => "ASC",
        "ID" => "ASC"
    );
$arFilter = Array(
        "SITE_ID"=>'ru'
    );
$arSelectedFields = Array("ID", "SITE_ID", "NAME");

$dbGroup = CBlogGroup::GetList($arOrder, $arFilter, false, false, $arSelectedFields);
while ($arGroup = $dbGroup->Fetch())
{
    print_r($arGroup);
}
?>


© «Bitrix24», 2001-2024
Up