<?php
namespace App\Console\Sales;
use App\Repository\CityRepository;
use App\Repository\SaloonAdBoardPlacementRepository;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class RotateSaloonAdBoardPlacementsCommand extends Command
{
public function __construct(
protected CityRepository $cityRepository,
protected SaloonAdBoardPlacementRepository $placementRepository
)
{
parent::__construct();
}
/**
* @inheritDoc
*/
protected function configure()
{
$this->setName('sales:saloon:adboard:rotate');
}
/**
* @inheritDoc
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$io->title('Rotating saloon adboard placements');
$io->progressStart();
foreach ($this->cityRepository->findAll() as $city) {
$this->placementRepository->rotateAdBoardStandardPositions($city);
$this->placementRepository->rotateAdBoardVipPositions($city);
$this->placementRepository->rotateAdBoardUltraVipPositions($city);
$io->progressAdvance();
}
$io->progressFinish();
$io->success('Success rotating saloon placements');
return Command::SUCCESS;
}
}