Skip to content

Commit

Permalink
refactor: Using attribute to definition command
Browse files Browse the repository at this point in the history
  • Loading branch information
siganushka committed Nov 27, 2024
1 parent bf2a668 commit a7c13cf
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Command/RegionUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
use Doctrine\ORM\EntityManagerInterface;
use Siganushka\RegionBundle\Entity\Region;
use Siganushka\RegionBundle\Repository\RegionRepository;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;

/**
* @see https://github.com/modood/Administrative-divisions-of-China
*/
#[AsCommand(
name: 'siganushka:region:update',
description: 'Update administrative divisions data to database.',
)]
class RegionUpdateCommand extends Command
{
/**
Expand All @@ -34,13 +36,12 @@ public function __construct(

protected function configure(): void
{
$this
->setName('siganushka:region:update')
->setDescription('Update administrative divisions data to database.')
->addOption('with-street', null, InputOption::VALUE_NONE, 'Whether to include streets?')
;
$this->addOption('with-street', null, InputOption::VALUE_NONE, 'Whether to include streets?');
}

/**
* @see https://github.com/modood/Administrative-divisions-of-China
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
ini_set('memory_limit', '2048M');
Expand Down

0 comments on commit a7c13cf

Please sign in to comment.