Files
afup/sources/AppBundle/Command/RegistrationsExporterCommand.php
Jean-Baptiste Nahan ab63791ce1 correction de la configuration (#767)
* correction de la configuration
* renommage des services pour preparer SF4
* remplacement des noms de service par les noms de classe
* ajout commentaire pour les services n'ayant pas de nom sous forme de nom de classe
2019-04-03 23:13:27 +02:00

40 lines
1.1 KiB
PHP

<?php
namespace AppBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class RegistrationsExporterCommand extends ContainerAwareCommand
{
/**
* @see Command
*/
protected function configure()
{
$this
->setName('export-registrations')
->addArgument('file', InputArgument::REQUIRED)
;
}
/**
* @see Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$container = $this->getContainer();
if (null === ($event = $container->get(\AppBundle\Event\Model\Repository\EventRepository::class)->getNextEvent())) {
$output->writeln('No event found');
return;
}
$file = new \SplFileObject($input->getArgument('file'), 'w+');
$container->get(\AppBundle\Event\Ticket\RegistrationsExportGenerator::class)->export($event, $file);
}
}