Projekt

Obecné

Profil

Stáhnout (955 Bajtů) Statistiky
| Větev: | Revize:
1
<?php
2

    
3
namespace App\Controller;
4

    
5
use Symfony\Component\Routing\Annotation\Route;
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7
use Doctrine\ODM\MongoDB\DocumentManager;
8
use App\Entity\OpenData;
9
use MongoDB\Client;
10

    
11
class HeatmapController extends AbstractController {
12

    
13
    /**
14
     * @Route("/heatmap")
15
     */
16
    public function index() {
17

    
18
        $client = new Client(
19
            'mongodb://root:root@database',
20
            [],
21
            [
22
                'typeMap' => [
23
                    'array' => 'array',
24
                    'document' => 'array',
25
                    'root' => 'array',
26
                ],
27
            ]
28
        );
29
        
30
        $db = $client->selectDatabase('open-data-db');
31
        $collection = $db->selectCollection("KOLOBEZKY31102018");
32
        $openData = $collection->find();
33

    
34
        return $this->render('heatmap.html.twig', [
35
            'open_data' => $openData->toArray()
36
        ]);
37
    }
38
}
(2-2/2)