source/Core/UtilsCount.php
protected function getAssoc($query, $parameters = [])
    {
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

        $resultSet = $database->select($query, $parameters);

        $rows = $resultSet->fetchAll();

        if (!$rows) {
            return [];
        }

        $result = [];

        foreach ($rows as $row) {
            $firstColumn = array_keys($row)[0];
            $key = $row[$firstColumn];

            $values = array_values($row);

            if (2 <= count($values)) {
                $result[$key] = $values[1];
            }
        }

        return $result;
    }
protected function getAssoc($query, $parameters = [])
    {
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

        $resultSet = $database->select($query, $parameters);

        $rows = $resultSet->fetchAll();

        if (!$rows) {
            return [];
        }

        $result = [];

        foreach ($rows as $row) {
            $firstColumn = array_keys($row)[0];
            $key = $row[$firstColumn];

            $values = array_values($row);

            if (2 <= count($values)) {
                $result[$key] = $values[1];
            }
        }

        return $result;
    }
protected function getAssoc ( $ query , $ parameters = [ ] ) { $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: FETCH_MODE_ASSOC ) ; $ resultSet = $ database -> select ( $ query , $ parameters ) ; $ rows = $ resultSet -> fetchAll ( ) ; if ( ! $ rows ) { return [ ] ; } $ result = [ ] ; foreach ( $ rows as $ row ) { $ firstColumn = array_keys ( $ row ) [ 0 ] ; $ key = $ row [ $ firstColumn ] ; $ values = array_values ( $ row ) ; if ( 2 <= count ( $ values ) ) { $ result [ $ key ] = $ values [ 1 ] ; } } return $ result ; }
Returns the query result as a two dimensional associative array.
The keys of the first level are the firsts value of each row.
The values of the first level arrays with numeric key that hold the all the values of each row but the first one,
which is used a a key in the first level.

@param string $query
@param array  $parameters

@return array
Returns the query result as a two dimensional associative array . The keys of the first level are the firsts value of each row . The values of the first level arrays with numeric key that hold the all the values of each row but the first one which is used a a key in the first level .