1 |
b8edf218
|
vastja
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace App\Controller;
|
4 |
|
|
|
5 |
|
|
use Symfony\Component\Routing\Annotation\Route;
|
6 |
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
7 |
5d0f8ac1
|
vastja
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
8 |
|
|
use App\Entity\OpenData;
|
9 |
|
|
use MongoDB\Client;
|
10 |
b8edf218
|
vastja
|
|
11 |
|
|
class HeatmapController extends AbstractController {
|
12 |
|
|
|
13 |
|
|
/**
|
14 |
|
|
* @Route("/heatmap")
|
15 |
|
|
*/
|
16 |
|
|
public function index() {
|
17 |
|
|
|
18 |
5d0f8ac1
|
vastja
|
$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 |
b8edf218
|
vastja
|
return $this->render('heatmap.html.twig', [
|
35 |
5d0f8ac1
|
vastja
|
'open_data' => $openData->toArray()
|
36 |
b8edf218
|
vastja
|
]);
|
37 |
|
|
}
|
38 |
|
|
}
|