protected function buildKeyedResultSet(array $results, string $primaryKey) : array
    {
        $builder = new EntityBuilder($this->mapper, array_keys($this->eagerLoads), $this->useCache);

        $keys = array_map(function ($item) use ($primaryKey) {
            return $item[$primaryKey];
        }, $results);

        return array_combine($keys, array_map(function ($item) use ($builder) {
            return $builder->build($item);
        }, $results));
    }
protected function buildKeyedResultSet(array $results, string $primaryKey) : array
    {
        $builder = new EntityBuilder($this->mapper, array_keys($this->eagerLoads), $this->useCache);

        $keys = array_map(function ($item) use ($primaryKey) {
            return $item[$primaryKey];
        }, $results);

        return array_combine($keys, array_map(function ($item) use ($builder) {
            return $builder->build($item);
        }, $results));
    }
protected function buildKeyedResultSet ( array $ results , string $ primaryKey ) : array { $ builder = new EntityBuilder ( $ this -> mapper , array_keys ( $ this -> eagerLoads ) , $ this -> useCache ) ; $ keys = array_map ( function ( $ item ) use ( $ primaryKey ) { return $ item [ $ primaryKey ] ; } , $ results ) ; return array_combine ( $ keys , array_map ( function ( $ item ) use ( $ builder ) { return $ builder -> build ( $ item ) ; } , $ results ) ) ; }
Build a result set keyed by PK.

@param array   $results
@param string. $primaryKey

@return array
Build a result set keyed by PK .