aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/AbstractNotificationCommand.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/AbstractNotificationCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/AbstractNotificationCommand.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Command/AbstractNotificationCommand.php b/src/Wallabag/CoreBundle/Command/AbstractNotificationCommand.php
new file mode 100644
index 00000000..b40b589a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Command/AbstractNotificationCommand.php
@@ -0,0 +1,41 @@
1<?php
2
3namespace Wallabag\CoreBundle\Command;
4
5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6use Symfony\Component\Console\Input\InputArgument;
7use Symfony\Component\Console\Output\OutputInterface;
8
9abstract class AbstractNotificationCommand extends ContainerAwareCommand
10{
11 /** @var OutputInterface */
12 protected $output;
13
14 protected function configure()
15 {
16 $this
17 ->addArgument(
18 'username',
19 InputArgument::OPTIONAL,
20 'User to send the notification to'
21 )
22 ;
23 }
24
25 /**
26 * Fetches a user from its username.
27 *
28 * @param string $username
29 *
30 * @return \Wallabag\UserBundle\Entity\User
31 */
32 protected function getUser($username)
33 {
34 return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username);
35 }
36
37 protected function getDoctrine()
38 {
39 return $this->getContainer()->get('doctrine');
40 }
41}