]>
Commit | Line | Data |
---|---|---|
e0f9010e TC |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\Command; | |
4 | ||
5 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
6 | use Symfony\Component\Console\Input\InputArgument; | |
7 | use Symfony\Component\Console\Output\OutputInterface; | |
8 | ||
9 | abstract 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 | } |