]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Command/ExportCommand.php
Merge pull request #3266 from egilli/export-domain-as-author
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Command / ExportCommand.php
index e3d3b399506ff4e3986a84b044f032c882732783..c2e4be05c9a87aac64a8cb63b42e9d3ac16b2e15 100644 (file)
@@ -32,15 +32,14 @@ class ExportCommand extends ContainerAwareCommand
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         try {
-            $user = $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($input->getArgument('username'));
+            $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username'));
         } catch (NoResultException $e) {
             $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username')));
 
             return 1;
         }
 
-        $entries = $this->getDoctrine()
-            ->getRepository('WallabagCoreBundle:Entry')
+        $entries = $this->getContainer()->get('wallabag_core.entry_repository')
             ->getBuilderForAllByUser($user->getId())
             ->getQuery()
             ->getResult();
@@ -50,13 +49,14 @@ class ExportCommand extends ContainerAwareCommand
         $filePath = $input->getArgument('filepath');
 
         if (!$filePath) {
-            $filePath = $this->getContainer()->getParameter('kernel.root_dir').'/../'.sprintf('%s-export.json', $user->getUsername());
+            $filePath = $this->getContainer()->getParameter('kernel.root_dir') . '/../' . sprintf('%s-export.json', $user->getUsername());
         }
 
         try {
             $data = $this->getContainer()->get('wallabag_core.helper.entries_export')
                 ->setEntries($entries)
                 ->updateTitle('All')
+                ->updateAuthor('All')
                 ->exportJsonData();
             file_put_contents($filePath, $data);
         } catch (\InvalidArgumentException $e) {