1 |
b8edf218
|
vastja
|
<?php
|
2 |
|
|
|
3 |
|
|
namespace App\Controller;
|
4 |
|
|
|
5 |
5d0f8ac1
|
vastja
|
use App\Entity\OpenData;
|
6 |
fd4fa4af
|
vastja
|
use MongoDB\Driver\Query;
|
7 |
fa91b0c1
|
vastja
|
use MongoDB\Driver\Manager;
|
8 |
|
|
use Symfony\Component\Routing\Annotation\Route;
|
9 |
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
10 |
b8edf218
|
vastja
|
|
11 |
|
|
class HeatmapController extends AbstractController {
|
12 |
|
|
/**
|
13 |
|
|
* @Route("/heatmap")
|
14 |
|
|
*/
|
15 |
|
|
public function index() {
|
16 |
fd4fa4af
|
vastja
|
$manager = new Manager(
|
17 |
|
|
'mongodb://root:root@database'
|
18 |
5d0f8ac1
|
vastja
|
);
|
19 |
fa91b0c1
|
vastja
|
|
20 |
fd4fa4af
|
vastja
|
$openData = $manager->executeQuery('open-data-db.KOLOBEZKY31102018', new Query([], []));
|
21 |
|
|
$openData->setTypeMap([
|
22 |
|
|
'array' => 'array',
|
23 |
|
|
'document' => 'array',
|
24 |
fa91b0c1
|
vastja
|
'root' => 'array',
|
25 |
b8edf218
|
vastja
|
]);
|
26 |
fd4fa4af
|
vastja
|
|
27 |
fa91b0c1
|
vastja
|
return $this->render('heatmap.html.twig', [
|
28 |
|
|
'open_data' => $openData->toArray(),
|
29 |
|
|
]);
|
30 |
b8edf218
|
vastja
|
}
|
31 |
20ecec4e
|
vastja
|
|
32 |
|
|
/**
|
33 |
|
|
* @Route("heatmap/opendata", name="opendata")
|
34 |
|
|
*/
|
35 |
|
|
public function opendata() {
|
36 |
|
|
$manager = new Manager(
|
37 |
|
|
'mongodb://root:root@database'
|
38 |
|
|
);
|
39 |
fa91b0c1
|
vastja
|
|
40 |
20ecec4e
|
vastja
|
$openData = $manager->executeQuery('open-data-db.KOLOBEZKY31102018', new Query([], []));
|
41 |
|
|
$openData->setTypeMap([
|
42 |
|
|
'array' => 'array',
|
43 |
|
|
'document' => 'array',
|
44 |
fa91b0c1
|
vastja
|
'root' => 'array',
|
45 |
|
|
]);
|
46 |
20ecec4e
|
vastja
|
|
47 |
|
|
return $this->json($openData->toArray());
|
48 |
|
|
}
|
49 |
fa91b0c1
|
vastja
|
}
|