src/Query/Select.php
private function _mergeAssociated(
        array $result,
        array $associated,
        $refKey,
        $colName
    ) {
        foreach ($result as $index => $item) {

            if (is_array($item)) {
                $refValue = $item[$refKey];
            } else {
                $refValue = $item->{$refKey};
            }

            if (isset($associated[$refValue])) {

                if (is_array($result[$index])) {
                    $result[$index][$colName] = $associated[$refValue];
                } else {
                    $result[$index]->{$colName} = $associated[$refValue];
                }
            }
        }
        return $result;
    }
private function _mergeAssociated(
        array $result,
        array $associated,
        $refKey,
        $colName
    ) {
        foreach ($result as $index => $item) {

            if (is_array($item)) {
                $refValue = $item[$refKey];
            } else {
                $refValue = $item->{$refKey};
            }

            if (isset($associated[$refValue])) {

                if (is_array($result[$index])) {
                    $result[$index][$colName] = $associated[$refValue];
                } else {
                    $result[$index]->{$colName} = $associated[$refValue];
                }
            }
        }
        return $result;
    }
private function _mergeAssociated ( array $ result , array $ associated , $ refKey , $ colName ) { foreach ( $ result as $ index => $ item ) { if ( is_array ( $ item ) ) { $ refValue = $ item [ $ refKey ] ; } else { $ refValue = $ item -> { $ refKey } ; } if ( isset ( $ associated [ $ refValue ] ) ) { if ( is_array ( $ result [ $ index ] ) ) { $ result [ $ index ] [ $ colName ] = $ associated [ $ refValue ] ; } else { $ result [ $ index ] -> { $ colName } = $ associated [ $ refValue ] ; } } } return $ result ; }
Merge associated data with result

@param array  $result
@param array  $associated
@param string $refKey
@param string $colName

@return array
Merge associated data with result