/
FetchSocialPostsCommand.php
34 lines (27 loc) · 1.11 KB
/
FetchSocialPostsCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace SocialDataBundle\Command;
use SocialDataBundle\Processor\SocialPostBuilderProcessor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class FetchSocialPostsCommand extends Command
{
protected static $defaultName = 'social-data:fetch:social-posts';
protected static $defaultDescription = 'Fetch Social Posts';
public function __construct(protected SocialPostBuilderProcessor $socialPostBuilderProcessor)
{
parent::__construct();
}
protected function configure(): void
{
$this
->addOption('wallId', 'w', InputOption::VALUE_REQUIRED, 'Only perform on specific wall')
->addOption('force', 'f', InputOption::VALUE_NONE, 'Update posts even if they\'re imported already');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->socialPostBuilderProcessor->process($input->getOption('force'), $input->getOption('wallId'));
return 0;
}
}