X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FCommand%2FAbstractNotificationCommand.php;fp=src%2FWallabag%2FCoreBundle%2FCommand%2FAbstractNotificationCommand.php;h=b40b589a1b4af002c60129c1c49c932bbd428300;hb=378aaefbbf60698c7b8faafc20f6b8cb22357e31;hp=0000000000000000000000000000000000000000;hpb=b5d7eb148c4cd62ff187b08765f0c13c7d330fcf;p=github%2Fwallabag%2Fwallabag.git 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 @@ +addArgument( + 'username', + InputArgument::OPTIONAL, + 'User to send the notification to' + ) + ; + } + + /** + * Fetches a user from its username. + * + * @param string $username + * + * @return \Wallabag\UserBundle\Entity\User + */ + protected function getUser($username) + { + return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username); + } + + protected function getDoctrine() + { + return $this->getContainer()->get('doctrine'); + } +}