Created
September 26, 2011 22:25
-
-
Save wowo/1243584 to your computer and use it in GitHub Desktop.
Closure logger from Symfony2 command
This file contains 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 | |
class SendMailingCommand extends ContainerAwareCommand | |
{ | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$logger = function($message) use ($output) | |
{ | |
$output->writeln($message); | |
}; | |
while (1) { | |
$this | |
->getContainer() | |
->get('wowo_newsletter.newsletter_manager') | |
->getJobFromQueueAndSendMailing($logger, $input->getOption('verbose')); | |
} | |
} | |
} |
This file contains 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
class SendMailingCommand extends ContainerAwareCommand | |
{ | |
protected function execute(InputInterface $input, OutputInterface $output) | |
{ | |
$logger = function($message) use ($output) | |
{ | |
$output->writeln($message); | |
}; | |
while (1) { | |
$this->getContainer()->get('wowo_newsletter.newsletter_manager')->getJobFromQueueAndSendMailing($logger, $input->getOption('verbose')); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment