Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Commit

Permalink
Updated pull request report command to accept branch argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelandrieu committed Jun 24, 2016
1 parent b8f9823 commit 6ba7ffe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/AppBundle/Command/SendPullRequestReportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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;
use Symfony\Component\Console\Style\SymfonyStyle;
Expand All @@ -12,17 +13,26 @@
*/
class SendPullRequestReportCommand extends ContainerAwareCommand
{
const DEFAULT_BRANCH = 'develop';

protected function configure()
{
$this
->setName('pull_request:report:send_mail')
->setDescription('Send pull requests by tag report mails.')
->addArgument(
'branch',
InputArgument::OPTIONAL,
'Select branch (`develop` by default)'
)
;
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$branch = $input->getArgument('branch') ? $input->getArgument('branch') : self::DEFAULT_BRANCH;

$groups = $this->getContainer()->getParameter('recipients');
$reporter = $this->getContainer()->get('app.pull_requests.reporter');
$mailer = $this->getContainer()->get('app.mailer');
Expand All @@ -41,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->getContainer()->getParameter('admin_mail'),
$groupMember,
'mail/pr_sumup_for_mail.html.twig',
$reporter->reportActivity()
$reporter->reportActivity($branch)
);
}
}
Expand Down

0 comments on commit 6ba7ffe

Please sign in to comment.