X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FCommand%2FImportCommand.php;h=4a174202a3bb32423d221d946a8a211b7f88df69;hb=a1bb1b3c2a0631ad41262ef92f6cce02c3d376bf;hp=f27aeff7f794c5950dcbf7024d2fe25679524557;hpb=56ea1de99bff55ce4149ea8070eabf8183d6f4fc;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Command/ImportCommand.php b/src/Wallabag/CoreBundle/Command/ImportCommand.php index f27aeff7..4a174202 100644 --- a/src/Wallabag/CoreBundle/Command/ImportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ImportCommand.php @@ -3,6 +3,7 @@ namespace Wallabag\CoreBundle\Command; 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\Helper\ProgressBar; @@ -15,7 +16,12 @@ class ImportCommand extends ContainerAwareCommand { $this ->setName('import:json') - ->setDescription('Import entries from JSON file'); + ->setDescription('Import entries from JSON file') + ->addArgument( + 'userId', + InputArgument::REQUIRED, + 'user ID to populate' + ); } protected function execute(InputInterface $input, OutputInterface $output) @@ -32,6 +38,8 @@ class ImportCommand extends ContainerAwareCommand protected function import(InputInterface $input, OutputInterface $output) { + $userId = $input->getArgument('userId'); + // Getting php array of data from CSV $data = $this->get($input, $output); @@ -48,7 +56,7 @@ class ImportCommand extends ContainerAwareCommand $progress->start(); $user = $em->getRepository('WallabagCoreBundle:User') - ->findOneById(1); + ->findOneById($userId); foreach ($data as $object) { $array = (array) $object;