Revize fd4fa4af
Přidáno uživatelem Jakub Vašta před téměř 5 roky(ů)
website/src/Controller/HeatmapController.php | ||
---|---|---|
6 | 6 |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
7 | 7 |
use Doctrine\ODM\MongoDB\DocumentManager; |
8 | 8 |
use App\Entity\OpenData; |
9 |
use MongoDB\Client; |
|
9 |
use MongoDB\Driver\Manager; |
|
10 |
use MongoDB\Driver\Query; |
|
10 | 11 |
|
11 | 12 |
class HeatmapController extends AbstractController { |
12 | 13 |
|
... | ... | |
15 | 16 |
*/ |
16 | 17 |
public function index() { |
17 | 18 |
|
18 |
$client = new Client( |
|
19 |
'mongodb://root:root@database', |
|
20 |
[], |
|
21 |
[ |
|
22 |
'typeMap' => [ |
|
23 |
'array' => 'array', |
|
24 |
'document' => 'array', |
|
25 |
'root' => 'array', |
|
26 |
], |
|
27 |
] |
|
19 |
$manager = new Manager( |
|
20 |
'mongodb://root:root@database' |
|
28 | 21 |
); |
29 | 22 |
|
30 |
$db = $client->selectDatabase('open-data-db'); |
|
31 |
$collection = $db->selectCollection("KOLOBEZKY31102018"); |
|
32 |
$openData = $collection->find(); |
|
33 |
|
|
23 |
$openData = $manager->executeQuery('open-data-db.KOLOBEZKY31102018', new Query([], [])); |
|
24 |
$openData->setTypeMap([ |
|
25 |
'array' => 'array', |
|
26 |
'document' => 'array', |
|
27 |
'root' => 'array' |
|
28 |
]); |
|
29 |
|
|
34 | 30 |
return $this->render('heatmap.html.twig', [ |
35 | 31 |
'open_data' => $openData->toArray() |
36 | 32 |
]); |
33 |
|
|
37 | 34 |
} |
38 | 35 |
} |
Také k dispozici: Unified diff
Re #7857 - MongoDB\Client -> MongoDB\Driver\Manager; Leaflet assets
+ MongoDB\Client not found - nesjpíš stará verze -> změněno na Manager
+ Připravena složka pro assety
+ Připraven leaflet.css a leaflet.js