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;
{
$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)
protected function import(InputInterface $input, OutputInterface $output)
{
+ $userId = $input->getArgument('userId');
+
// Getting php array of data from CSV
$data = $this->get($input, $output);
$progress->start();
$user = $em->getRepository('WallabagCoreBundle:User')
- ->findOneById(1);
+ ->findOneById($userId);
foreach ($data as $object) {
$array = (array) $object;