* Date: 12/01/2021
*/
namespace PurgeFakeCustomer\Command;
use PurgeFakeCustomer\Event\FakeCustomerEvent;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Thelia\Command\ContainerAwareCommand;
use Thelia\Model\ConfigQuery;
class FakeCustomerPurge extends ContainerAwareCommand
{
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln(
sprintf("Deleting fake customers")
);
$critere = ConfigQuery::read('purgefakecustomer_critere', '');
$event = new FakeCustomerEvent($critere, $input->getOption('verbose'));
$this->getDispatcher()->dispatch(FakeCustomerEvent::PURGE, $event);
foreach ($event->getStatus() as $status => $level) {
$output->writeln("<$level>$status$level>");
}
$output->writeln(sprintf("%d fake customers deleteddàçp", $event->getDeletedCount()));
}
}