From 25203e5081c8da21869db1d16610f83f888249b5 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 10 Jun 2017 12:33:58 +0200 Subject: User existing service instead of getDoctrine --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index e3d3b399..e4977e11 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -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->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); } catch (NoResultException $e) { $output->writeln(sprintf('User "%s" not found.', $input->getArgument('username'))); return 1; } - $entries = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') + $entries = $this->get('wallabag_core.entry_repository') ->getBuilderForAllByUser($user->getId()) ->getQuery() ->getResult(); -- cgit v1.2.3 From 03ce43d466daf9d085f5b521b223cb8b351a1c0e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 10 Jun 2017 13:19:43 +0200 Subject: Fix getContainer in command --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index e4977e11..ebb2b4cf 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -32,14 +32,14 @@ class ExportCommand extends ContainerAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { try { - $user = $this->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); + $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); } catch (NoResultException $e) { $output->writeln(sprintf('User "%s" not found.', $input->getArgument('username'))); return 1; } - $entries = $this->get('wallabag_core.entry_repository') + $entries = $this->getContainer()->get('wallabag_core.entry_repository') ->getBuilderForAllByUser($user->getId()) ->getQuery() ->getResult(); -- cgit v1.2.3 From f808b01692a835673f328d7221ba8c212caa9b61 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Jul 2017 09:52:38 +0200 Subject: Add a real configuration for CS-Fixer --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index ebb2b4cf..0dacb734 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -49,7 +49,7 @@ 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 { -- cgit v1.2.3 From 07320a2bd25c6ace1f9b1aa06b1b08e8dbf4f4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Gilli?= Date: Sat, 8 Jul 2017 17:55:58 +0200 Subject: Use the article domain as author for export files When exporting an entry, use the domain name as author name for epub, mobi and pdf formats, instead of 'wallabag'. Change the author from array to string, because for now, there is always only one author. --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index 0dacb734..c2e4be05 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -56,6 +56,7 @@ class ExportCommand extends ContainerAwareCommand $data = $this->getContainer()->get('wallabag_core.helper.entries_export') ->setEntries($entries) ->updateTitle('All') + ->updateAuthor('All') ->exportJsonData(); file_put_contents($filePath, $data); } catch (\InvalidArgumentException $e) { -- cgit v1.2.3 From a19e212f433be7d989f27c6271cba9a84fcefac9 Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Thu, 27 Jul 2017 23:44:12 +0200 Subject: Remove unused method getDoctrine in several commands --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index c2e4be05..291926e4 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -69,9 +69,4 @@ class ExportCommand extends ContainerAwareCommand return 0; } - - private function getDoctrine() - { - return $this->getContainer()->get('doctrine'); - } } -- cgit v1.2.3 From e1b33efb3dd7c9ebb4dcfb23a2ca5efbda0a05f6 Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Sat, 29 Jul 2017 00:30:22 +0200 Subject: Better rendering for all core commands --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index 291926e4..b07087c8 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; class ExportCommand extends ContainerAwareCommand { @@ -31,10 +32,12 @@ class ExportCommand extends ContainerAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { + $io = new SymfonyStyle($input, $output); + try { $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); } catch (NoResultException $e) { - $output->writeln(sprintf('User "%s" not found.', $input->getArgument('username'))); + $io->error(sprintf('User "%s" not found.', $input->getArgument('username'))); return 1; } @@ -44,7 +47,7 @@ class ExportCommand extends ContainerAwareCommand ->getQuery() ->getResult(); - $output->write(sprintf('Exporting %d entrie(s) for user « %s »... ', count($entries), $user->getUserName())); + $io->text(sprintf('Exporting %d entrie(s) for user %s...', count($entries), $user->getUserName())); $filePath = $input->getArgument('filepath'); @@ -60,12 +63,12 @@ class ExportCommand extends ContainerAwareCommand ->exportJsonData(); file_put_contents($filePath, $data); } catch (\InvalidArgumentException $e) { - $output->writeln(sprintf('Error: "%s"', $e->getMessage())); + $io->error(sprintf('Error: "%s"', $e->getMessage())); return 1; } - $output->writeln('Done.'); + $io->success('Done.'); return 0; } -- cgit v1.2.3 From 9ca069a6fea67ddf2ef44601901ea3c02e3cffbe Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Fri, 13 Oct 2017 23:52:15 +0200 Subject: Replace kernel.root_dir by kernel.project_dir kernel.root_dir and Kernel::getRootDir() are deprecated since Symfony 3.3. See https://symfony.com/blog/new-in-symfony-3-3-a-simpler-way-to-get-the-project-root-directory and https://github.com/symfony/symfony/blob/3.3/UPGRADE-3.3.md#httpkernel for more information. --- src/Wallabag/CoreBundle/Command/ExportCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Command/ExportCommand.php') diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index b07087c8..75e9ad91 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -52,7 +52,7 @@ 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.project_dir') . '/' . sprintf('%s-export.json', $user->getUsername()); } try { -- cgit v1.2.3