Created
June 16, 2014 13:41
-
-
Save jmeyo/ba98a69053289016058c to your computer and use it in GitHub Desktop.
Generate invoices command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Example\BackBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class ValidateOrdersCommand extends ContainerAwareCommand { | |
protected function configure() { | |
$this | |
->setName('invoices:generate') | |
->setDescription('Generate the Invoices') | |
->addOption( | |
'month', | |
'd', | |
InputOption::VALUE_OPTIONAL, | |
'The month to generate invoices for', | |
date('Y-m') | |
) | |
; | |
} | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$month = $input->getOption('month'); | |
$res = $this->getContainer()->get('some.manager')->generateInvoices($month, $after); | |
$output->writeln("<comment>$res</comment> <info>invoices were generated!</info>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment