Revize fa91b0c1
Přidáno uživatelem Jakub Vašta před téměř 5 roky(ů)
website/src/Controller/HeatmapController.php | ||
---|---|---|
2 | 2 |
|
3 | 3 |
namespace App\Controller; |
4 | 4 |
|
5 |
use Symfony\Component\Routing\Annotation\Route; |
|
6 |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
7 |
use Doctrine\ODM\MongoDB\DocumentManager; |
|
8 | 5 |
use App\Entity\OpenData; |
9 |
use MongoDB\Driver\Manager; |
|
10 | 6 |
use MongoDB\Driver\Query; |
7 |
use MongoDB\Driver\Manager; |
|
8 |
use Symfony\Component\Routing\Annotation\Route; |
|
9 |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
11 | 10 |
|
12 | 11 |
class HeatmapController extends AbstractController { |
13 |
|
|
14 | 12 |
/** |
15 | 13 |
* @Route("/heatmap") |
16 | 14 |
*/ |
17 | 15 |
public function index() { |
18 |
|
|
19 | 16 |
$manager = new Manager( |
20 | 17 |
'mongodb://root:root@database' |
21 | 18 |
); |
22 |
|
|
19 |
|
|
23 | 20 |
$openData = $manager->executeQuery('open-data-db.KOLOBEZKY31102018', new Query([], [])); |
24 | 21 |
$openData->setTypeMap([ |
25 | 22 |
'array' => 'array', |
26 | 23 |
'document' => 'array', |
27 |
'root' => 'array' |
|
28 |
]); |
|
29 |
|
|
30 |
return $this->render('heatmap.html.twig', [ |
|
31 |
'open_data' => $openData->toArray() |
|
24 |
'root' => 'array', |
|
32 | 25 |
]); |
33 | 26 |
|
27 |
return $this->render('heatmap.html.twig', [ |
|
28 |
'open_data' => $openData->toArray(), |
|
29 |
]); |
|
34 | 30 |
} |
35 | 31 |
|
36 | 32 |
/** |
37 | 33 |
* @Route("heatmap/opendata", name="opendata") |
38 | 34 |
*/ |
39 | 35 |
public function opendata() { |
40 |
|
|
41 | 36 |
$manager = new Manager( |
42 | 37 |
'mongodb://root:root@database' |
43 | 38 |
); |
44 |
|
|
39 |
|
|
45 | 40 |
$openData = $manager->executeQuery('open-data-db.KOLOBEZKY31102018', new Query([], [])); |
46 | 41 |
$openData->setTypeMap([ |
47 | 42 |
'array' => 'array', |
48 | 43 |
'document' => 'array', |
49 |
'root' => 'array' |
|
50 |
]);
|
|
44 |
'root' => 'array',
|
|
45 |
]); |
|
51 | 46 |
|
52 | 47 |
return $this->json($openData->toArray()); |
53 |
|
|
54 | 48 |
} |
55 |
} |
|
49 |
} |
Také k dispozici: Unified diff
fast linter fix