41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Command;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use App\Entity\SupportedArea;
|
|
|
|
use App\Service\KMLFileImporter;
|
|
|
|
class ImportKMLFileCommand extends Command
|
|
{
|
|
protected $importer;
|
|
|
|
protected function configure()
|
|
{
|
|
$this->setName('supportedarea:import')
|
|
->setDescription('Extracts map data of the supported area from the KML file and saves to database')
|
|
->setHelp('Gets the coordinates of the supported area and saves to the database')
|
|
->addArgument('file', InputArgument::REQUIRED, 'Path to the KML file');
|
|
}
|
|
|
|
public function __construct(KMLFileImporter $importer)
|
|
{
|
|
$this->importer = $importer;
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$kml_file = $input->getArgument('file');
|
|
|
|
$this->importer->getMapData($kml_file);
|
|
|
|
return 0;
|
|
}
|
|
}
|