$data = array();
foreach($stmt->fetchAll() as $val){
$data[$val['id']] = $val;
}
$data = $stmt->fetchAll(PDO::FETCH_UNIQUE);
$data = $pdo->query("SELECT id, name FROM table")fetchAll(PDO::FETCH_KEY_PAIR);
$data = array_column($stmt->fetchAll(), null, 'id');