private function processHydration(&$row)
    {
        if (!count($this->hydrationMappings)){
            return;
        }
        
        $primaryFields = [];
        $rawData = [];

        foreach($row as $key => $value){
            if (isset($this->hydrationMappings[$key])){
                unset($row[$key]);

                $primary = $this->hydrationMappings[$key][0];
                $field = $this->hydrationMappings[$key][1];

                /**
                 * @var Repository $repos
                 */
                $repos = $this->hydrationMappings[$key][2];
                $reposClass = $repos->getModelClass();

                if (!isset($rawData[$reposClass])){
                    $rawData[$reposClass] = [ "repos" => $repos, "data" => []];
                }

                if ($field == $primary){
                    $primaryFields[$reposClass] = $value;
                }

                if (isset($primaryFields[$reposClass])){
                    if (!isset($rawData[$reposClass]["data"][$primaryFields[$reposClass]])){
                        $rawData[$reposClass]["data"][$primaryFields[$reposClass]] = [];
                    }

                    $rawData[$reposClass]["data"][$primaryFields[$reposClass]][$primary] = $value;
                }
            }
        }

        foreach($rawData as $reposClass => $reposDetails){
            $repos = $reposDetails["repos"];
            $data = $reposDetails["data"];
            foreach($data as $id => $rawRow){
                $repos->cachedObjectData[$id] = $repos->transformDataFromRepository($rawRow);
            }
        }
    }
private function processHydration(&$row)
    {
        if (!count($this->hydrationMappings)){
            return;
        }
        
        $primaryFields = [];
        $rawData = [];

        foreach($row as $key => $value){
            if (isset($this->hydrationMappings[$key])){
                unset($row[$key]);

                $primary = $this->hydrationMappings[$key][0];
                $field = $this->hydrationMappings[$key][1];

                /**
                 * @var Repository $repos
                 */
                $repos = $this->hydrationMappings[$key][2];
                $reposClass = $repos->getModelClass();

                if (!isset($rawData[$reposClass])){
                    $rawData[$reposClass] = [ "repos" => $repos, "data" => []];
                }

                if ($field == $primary){
                    $primaryFields[$reposClass] = $value;
                }

                if (isset($primaryFields[$reposClass])){
                    if (!isset($rawData[$reposClass]["data"][$primaryFields[$reposClass]])){
                        $rawData[$reposClass]["data"][$primaryFields[$reposClass]] = [];
                    }

                    $rawData[$reposClass]["data"][$primaryFields[$reposClass]][$primary] = $value;
                }
            }
        }

        foreach($rawData as $reposClass => $reposDetails){
            $repos = $reposDetails["repos"];
            $data = $reposDetails["data"];
            foreach($data as $id => $rawRow){
                $repos->cachedObjectData[$id] = $repos->transformDataFromRepository($rawRow);
            }
        }
    }
private function processHydration ( & $ row ) { if ( ! count ( $ this -> hydrationMappings ) ) { return ; } $ primaryFields = [ ] ; $ rawData = [ ] ; foreach ( $ row as $ key => $ value ) { if ( isset ( $ this -> hydrationMappings [ $ key ] ) ) { unset ( $ row [ $ key ] ) ; $ primary = $ this -> hydrationMappings [ $ key ] [ 0 ] ; $ field = $ this -> hydrationMappings [ $ key ] [ 1 ] ; /**
                 * @var Repository $repos
                 */ $ repos = $ this -> hydrationMappings [ $ key ] [ 2 ] ; $ reposClass = $ repos -> getModelClass ( ) ; if ( ! isset ( $ rawData [ $ reposClass ] ) ) { $ rawData [ $ reposClass ] = [ "repos" => $ repos , "data" => [ ] ] ; } if ( $ field == $ primary ) { $ primaryFields [ $ reposClass ] = $ value ; } if ( isset ( $ primaryFields [ $ reposClass ] ) ) { if ( ! isset ( $ rawData [ $ reposClass ] [ "data" ] [ $ primaryFields [ $ reposClass ] ] ) ) { $ rawData [ $ reposClass ] [ "data" ] [ $ primaryFields [ $ reposClass ] ] = [ ] ; } $ rawData [ $ reposClass ] [ "data" ] [ $ primaryFields [ $ reposClass ] ] [ $ primary ] = $ value ; } } } foreach ( $ rawData as $ reposClass => $ reposDetails ) { $ repos = $ reposDetails [ "repos" ] ; $ data = $ reposDetails [ "data" ] ; foreach ( $ data as $ id => $ rawRow ) { $ repos -> cachedObjectData [ $ id ] = $ repos -> transformDataFromRepository ( $ rawRow ) ; } } }
Takes a row with hydrated data and extracts it from the array.

@param $row
Takes a row with hydrated data and extracts it from the array .