Add hub output with distance. #652

This commit is contained in:
Korina Cordero 2022-03-24 08:19:44 +00:00
parent 85be728bf6
commit 3e238347be

View file

@ -13,7 +13,7 @@ use App\Service\MapTools;
class TestClosestOpenHubsCommand extends Command
{
$protected $maptools;
protected $maptools;
protected function configure()
{
@ -37,7 +37,16 @@ class TestClosestOpenHubsCommand extends Command
$lat = $input->getArgument('lat');
$point = new Point($long, $lat);
$this->maptools->getClosestOpenHubs();
$hubs_with_distance = $this->maptools->getClosestOpenHubs($point, 10);
foreach($hubs_with_distance as $hub_dist)
{
$hub = $hub_dist['hub'];
$distance = $hub_dist['distance'];
error_log('Hub ID ' . $hub->getID() . ' - ' . $hub->getName() . ' = ' . $distance . ' kms away.');
}
return 0;
}