Création du module PurgeFakeCustomer
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Laurent LE CORRE <laurent@thecoredev.fr>
|
||||
* 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("<info>Deleting fake customers</info>")
|
||||
);
|
||||
|
||||
$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("<info>%d fake customers deleteddàçp</info>", $event->getDeletedCount()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user