Prado\Data\SqlMap\Statements\TMappedStatement::addResultMapGroupBy PHP Метод

addResultMapGroupBy() защищенный Метод

ResultMap with GroupBy property. Save object collection graph in a tree and collect the result later.
protected addResultMapGroupBy ( $resultMap, $row, $parent, &$resultObject ) : object
Результат object result object.
    protected function addResultMapGroupBy($resultMap, $row, $parent, &$resultObject)
    {
        $group = $this->getResultMapGroupKey($resultMap, $row);
        if (empty($parent)) {
            $rootObject = array('object' => $resultObject, 'property' => null);
            $this->_groupBy->add(null, $group, $rootObject);
        }
        foreach ($resultMap->getColumns() as $property) {
            //set properties.
            $this->setObjectProperty($resultMap, $property, $row, $resultObject);
            $nested = $property->getResultMapping();
            //nested property
            if ($this->getManager()->getResultMaps()->contains($nested)) {
                $nestedMap = $this->getManager()->getResultMap($nested);
                $groupKey = $this->getResultMapGroupKey($nestedMap, $row);
                //add the node reference first
                if (empty($parent)) {
                    $this->_groupBy->add($group, $groupKey, '');
                }
                //get the nested result mapping value
                $value = $this->fillResultMap($nested, $row, $groupKey);
                //add it to the object tree graph
                $groupObject = array('object' => $value, 'property' => $property->getProperty());
                if (empty($parent)) {
                    $this->_groupBy->add($group, $groupKey, $groupObject);
                } else {
                    $this->_groupBy->add($parent, $groupKey, $groupObject);
                }
            }
        }
        return $resultObject;
    }