Formats `group` clauses for MongoDB.

@param string|array $group The group clause.
@param object $context
@return array Formatted `group` clause.
424704
public function group($group, $context) {
		if (!$group) {
			return;
		}
		if (is_string($group) && strpos($group, 'function') === 0) {
			return ['$keyf' => new MongoCode($group)];
		}
		$group = (array) $group;

		foreach ($group as $i => $field) {
			if (is_int($i)) {
				$group[$field] = true;
				unset($group[$i]);
			}
		}
		return ['key' => $group];
	}
271873
public function group($group)
    {
        $group = $this->prepareNames(func_get_args(), false);
        $this->group = $group;
        return $this;
    }
961197
private function applyCollectedDqlConditions(array $group): void
    {
        if (!$this->dqlConditions) {
            return;
        }

        if ($group['conditionsLogic'] === 'AND') {
            $fieldsDql = $this->queryBuilder->expr()->andX(...$this->dqlConditions);
        } else {
            $fieldsDql = $this->queryBuilder->expr()->orX(...$this->dqlConditions);
        }

        if ($group['groupLogic'] === 'AND') {
            $this->queryBuilder->andWhere($fieldsDql);
        } else {
            $this->queryBuilder->orWhere($fieldsDql);
        }

        $this->dqlConditions = [];
    }
821160
public function serialize($data, $group = null)
    {
        $context = new SerializationContext();

        if ($group) {
            $context->setGroups($group);
        }

        return $this->serializer->serialize($data, 'json', $context);
    }
632677
public function addGrouping(array $grouping)
	{
		foreach ($grouping as $name => $value)
		{
			$this->groupBy($name, $value);
		}

		return $this;
	}
1227651
protected function groupToWords($group) {
        $d3 = floor($group / 100);
        $d2 = floor(($group - $d3 * 100) / 10);
        $d1 = $group - $d3 * 100 - $d2 * 10;

        $group_array = array();

        if ($d3 != 0) {
            $group_array[] = $this->number_word['d3'][$d3];
        }

        if ($d2 == 1 && $d1 != 0) { // 11-19
            $group_array[] = $this->number_word['d2-1'][$d1];
        } else if ($d2 != 0 && $d1 == 0) { // 10-20-...-90
            $group_array[] = $this->number_word['d2-2'][$d2];
        } else if ($d2 == 0 && $d1 == 0) { // 00
        } else if ($d2 == 0 && $d1 != 0) { // 1-9
            $group_array[] = $this->number_word['d1'][$d1];
        } else { // Others
            $group_array[] = $this->number_word['d2-2'][$d2];
            $group_array[] = $this->number_word['d1'][$d1];
        }
        if (!count($group_array)) {
            return FALSE;
        }
        return $group_array;
    }
171303
protected function loadGroupedOrderIndexes(PersistenceContext $context, array $rows)
    {
        /** @var Row[][] $groupedRows */
        $groupedRows        = [];
        $groupingValues     = [];
        $groupingColumnName = $this->groupingColumn->getName();

        foreach ($rows as $row) {
            $groupingValue = $row->getColumn($groupingColumnName);
            $groupHash     = $groupingValue instanceof \DateTimeInterface
                    ? $groupingValue->format('Y-m-d H:i:s')
                    : $groupingValue;

            $groupingValues[$groupHash] = $groupingValue;
            $groupedRows[$groupHash][]  = $row;
        }

        $groupingColumn = Expr::column($this->table->getName(), $this->groupingColumn);
        $select         = Select::from($this->table)
                ->addColumn('order_index', Expr::max(Expr::column($this->table->getName(), $this->orderColumn)))
                ->addColumn('group', $groupingColumn)
                ->where(Expr::in(
                        $groupingColumn,
                        Expr::tupleParams($this->groupingColumn->getType(), $groupingValues)
                ))
                ->addGroupBy($groupingColumn);

        $orderIndexes        = $context->getConnection()->load($select)->asArray();
        $indexedOrderIndexes = [];

        foreach ($orderIndexes as $orderIndexRow) {
            $groupHash = $orderIndexRow['group'] instanceof \DateTimeInterface
                    ? $orderIndexRow['group']->format('Y-m-d H:i:s')
                    : $orderIndexRow['group'];

            $indexedOrderIndexes[$groupHash] = $orderIndexRow['order_index'];
        }
        
        $orderColumn = $this->orderColumn->getName();

        foreach ($groupedRows as $groupHash => $rows) {
            $orderIndex = isset($indexedOrderIndexes[$groupHash])
                    ? $indexedOrderIndexes[$groupHash] + 1
                    : 1;

            foreach ($rows as $row) {
                $row->setColumn($orderColumn, $orderIndex);
                $orderIndex++;
            }
        }
    }
1168198
public function getTabGroup(string $group): TabGroup
    {
        if (!isset($this->tabGroups[$group])) {
            throw new \InvalidArgumentException(sprintf('Requested group named "%s" is not found. Did you forget to tag the service?', $group));
        }

        return $this->tabGroups[$group];
    }
344131
public function setGroup($group)
    {
        if (isset($this->options['group']) && $this->options['group']) {
            $group = $this->options['group'] . '/' . $group;
        }
        return $this->setOption('group', $group);
    }
1016478
public function getAdminsByGroup($group)
    {
        if (!isset($this->adminGroups[$group])) {
            throw new \InvalidArgumentException(sprintf('Group "%s" not found in admin pool.', $group));
        }

        $admins = [];

        if (!isset($this->adminGroups[$group]['items'])) {
            return $admins;
        }

        foreach ($this->adminGroups[$group]['items'] as $item) {
            $admins[] = $this->getInstance($item['admin']);
        }

        return $admins;
    }
1099084
public function group($query)
    {
        $clause = '';

        if (!empty($query->group)) {
            $columns = AnDomainQueryHelper::parseColumns($query, $query->group);
            $clause = ' GROUP BY '.implode(' , ', $columns);
        }

        return $clause;
    }
103786
protected function compileGrouping(array $grouping): string
    {
        $statement = '';
        foreach ($grouping as $identifier) {
            $statement .= $this->quote($identifier);
        }

        return $statement;
    }
1096104
public function group(string $group, array $data = [], ?callable $callback = null): self
    {
        $data = new Data($data);

        // No callback, set prepared group
        $this->preparedGroups[$group] = $data;

        $new = $this->cloneInstance();
        $new->setOptions($data);
        $new->package((string) $this->getOption('package'));
        $new->group = $group;
        $new->groups[$group] = $data;

        // Find parents
        if (isset($data['parents'])) {
            $this->parents((array) $data['parents']);
        }

        if ($callback) {
            $this->groups[$group] = $data;

            $callback($this);

            array_pop($this->groups);
        }

        return $new;
    }
777107
public function getGroup($group)
    {
        $timeStamp = time();
        if ($group instanceof BundleEntity\MemberGroup) {
            return new ModelResponse($group, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
        }
        $result = null;
        switch ($group) {
            case is_numeric($group):
                $result = $this->em->getRepository($this->entity['mg']['name'])->findOneBy(array('id' => $group));
                break;
            case is_string($group):
                $result = $this->em->getRepository($this->entity['mg']['name'])->findOneBy(array('code' => $group));
                break;
        }
        if (is_null($result)) {
            return new ModelResponse($result, 0, 0, null, true, 'E:D:002', 'Unable to find request entry in database.', $timeStamp, time());
        }

        return new ModelResponse($result, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
    }
173726
public function all($group = self::DEFAULT_GROUP) {
        if( $group == self::DEFAULT_GROUP )
            return $this->settings;

        return isset($this->settings[$group]) ? $this->settings[$group] : [];
    }
284211
public function groupBy($group)
    {
        if (is_string($group)) {
            $group = [$group];
        }

        $this->group = $group;
        return $this;
    }
1338819
public function inGroup($group = null) {
    if (is_numeric($group)) {
      $group = Group::factory((int) $group);
    }
    if (!isset($group->guid)) {
      return false;
    }
    return ($group->inArray((array) $this->groups) || $group->is($this->group));
  }