-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a001ab
commit a79af42
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class NotifyUnprocessedInquiryCommand extends ContainerAwareCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('cs:inquiry:notify-unprocessed') | ||
->setDescription('未処理お問い合わせ一覧を通知') | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$container = $this->getContainer(); | ||
|
||
$em = $container->get('doctrine')->getManager(); | ||
$inquiryRepository = $em->getRepository('AppBundle:Inquiry'); | ||
|
||
$inquiryList = $inquiryRepository->findUnprocessed(); | ||
|
||
if (count($inquiryList) > 0) { | ||
$templating = $container->get('templating'); | ||
|
||
$message = \Swift_Message::newInstance() | ||
->setSubject('[CS] 未処理お問い合わせ通知') | ||
->setFrom('[email protected]') | ||
->setTo('[email protected]') | ||
->setBody( | ||
$templating->render( | ||
'mail/admin_unprocessedInquiryList.txt.twig', | ||
['inquiryList' => $inquiryList] | ||
) | ||
); | ||
|
||
$container->get('mailer')->send($message); | ||
|
||
$output->writeln(count($inquiryList) . "件の未処理を通知"); | ||
} else { | ||
$output->writeln("未処理なし"); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class NotifyUnprocessedInquiryCommand extends ContainerAwareCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('cs:inquiry:notify-unprocessed') | ||
->setDescription('未処理お問い合わせ一覧を通知') | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$container = $this->getContainer(); | ||
|
||
$em = $container->get('doctrine')->getManager(); | ||
$inquiryRepository = $em->getRepository('AppBundle:Inquiry'); | ||
|
||
$inquiryList = $inquiryRepository->findUnprocessed(); | ||
|
||
if (count($inquiryList) > 0) { | ||
$templating = $container->get('templating'); | ||
|
||
$message = \Swift_Message::newInstance() | ||
->setSubject('[CS] 未処理お問い合わせ通知') | ||
->setFrom('[email protected]') | ||
->setTo('[email protected]') | ||
->setBody( | ||
$templating->render( | ||
'mail/admin_unprocessedInquiryList.txt.twig', | ||
['inquiryList' => $inquiryList] | ||
) | ||
); | ||
|
||
$container->get('mailer')->send($message); | ||
|
||
$output->writeln(count($inquiryList) . "件の未処理を通知"); | ||
} else { | ||
$output->writeln("未処理なし"); | ||
} | ||
} | ||
} |