|
11 | 11 |
|
12 | 12 | use JbDevLabs\SyliusCliContextPlugin\CliContext\CliChannelContext; |
13 | 13 | use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; |
| 14 | +use Symfony\Component\Console\Attribute\AsCommand; |
14 | 15 | use Symfony\Component\Console\Command\Command; |
15 | 16 | use Symfony\Component\Console\Input\InputInterface; |
16 | 17 | use Symfony\Component\Console\Input\InputOption; |
17 | 18 | use Symfony\Component\Console\Output\OutputInterface; |
18 | 19 |
|
| 20 | +#[AsCommand('app:change-channel')] |
19 | 21 | final class LoadChannelManuallyCommand extends Command |
20 | 22 | { |
21 | 23 | protected static $defaultName = 'app:change-channel'; |
22 | | - private CliChannelContext $channelContext; |
23 | | - private ChannelRepositoryInterface $channelRepository; |
24 | 24 |
|
25 | | - public function __construct(CliChannelContext $channelContext, ChannelRepositoryInterface $channelRepository) |
| 25 | + public function __construct(private readonly CliChannelContext $channelContext, private readonly ChannelRepositoryInterface $channelRepository) |
26 | 26 | { |
27 | 27 | parent::__construct(); |
28 | | - $this->channelContext = $channelContext; |
29 | | - $this->channelRepository = $channelRepository; |
30 | 28 | } |
31 | 29 |
|
32 | | - protected function configure() |
| 30 | + protected function configure(): void |
33 | 31 | { |
34 | 32 | $this->addOption('channel', 'c', InputOption::VALUE_REQUIRED, 'Channel code to use durring the running command', |
35 | 33 | null); |
36 | 34 | } |
37 | 35 |
|
38 | 36 |
|
39 | | - protected function execute(InputInterface $input, OutputInterface $output) |
| 37 | + protected function execute(InputInterface $input, OutputInterface $output): int |
40 | 38 | { |
41 | 39 | $channel = $input->getOption('channel'); |
42 | 40 |
|
|
0 commit comments