mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
import addresses and postal codes from bestaddress
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Command;
|
||||
|
||||
use Chill\MainBundle\Service\Import\AddressReferenceBEFromBestAddress;
|
||||
use Chill\MainBundle\Service\Import\PostalCodeBEFromBestAddress;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class LoadAddressesBEFromBestAddressCommand extends Command
|
||||
{
|
||||
private AddressReferenceBEFromBestAddress $addressImporter;
|
||||
|
||||
private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter;
|
||||
|
||||
public function __construct(
|
||||
AddressReferenceBEFromBestAddress $addressImporter,
|
||||
PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
|
||||
) {
|
||||
parent::__construct();
|
||||
$this->addressImporter = $addressImporter;
|
||||
$this->postalCodeBEFromBestAddressImporter = $postalCodeBEFromBestAddressImporter;
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('chill:main:address-ref-from-best-addresses')
|
||||
->addArgument('lang', InputArgument::REQUIRED)
|
||||
->addArgument('list', InputArgument::IS_ARRAY, 'The list to add');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$this->postalCodeBEFromBestAddressImporter->import();
|
||||
|
||||
$this->addressImporter->import($input->getArgument('lang'), $input->getArgument('list'));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user