protected function execute(InputInterface $input, OutputInterface $output)
 {
     /* @var $notification \Civix\CoreBundle\Service\Notification */
     $notification = $this->getContainer()->get('civix_core.notification');
     /* @var $em \Doctrine\ORM\EntityManager */
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $users = $em->getRepository('CivixCoreBundle:User')->findAll();
     /* @var $user \Civix\CoreBundle\Entity\User */
     foreach ($users as $user) {
         if ($user->getAndroidDevice()) {
             $endpoint = new Notification\AndroidEndpoint();
             $endpoint->setToken($user->getAndroidDevice())->setUser($user);
             $notification->handleEndpoint($endpoint);
             $output->writeln("<comment>Added android endpoint for user:</comment> {$user->getUsername()}");
         }
         if ($user->getIosDevice()) {
             $endpoint = new Notification\IOSEndpoint();
             $endpoint->setToken($user->getIosDevice())->setUser($user);
             $notification->handleEndpoint($endpoint);
             $output->writeln("<comment>Added ios endpoint for user:</comment> {$user->getUsername()}");
         }
     }
 }
 /**
  * @group notification
  */
 public function testPlatformMessage()
 {
     $endpoint = new AndroidEndpoint();
     $this->assertEquals($endpoint->getPlatformMessage('test_message', 'test_type', null), '{"GCM":"{\\"data\\":{\\"message\\":\\"test_message\\",\\"type\\":\\"test_type\\",\\"entity\\":\\"null\\"}}"}');
 }
 public function getUser()
 {
     $this->__load();
     return parent::getUser();
 }